Add docker support for development environment
This commit is contained in:
parent
ca4383b113
commit
8609a09f4b
16
README.md
16
README.md
|
@ -23,12 +23,24 @@ stored in
|
||||||
|
|
||||||
To set up a local instance of [doc.silverstripe.org](https://github.com/silverstripe/doc.silverstripe.org):
|
To set up a local instance of [doc.silverstripe.org](https://github.com/silverstripe/doc.silverstripe.org):
|
||||||
|
|
||||||
* Install [Gatsby CLI](https://gatsbyjs.com)
|
|
||||||
* Clone this repository to an empty directory
|
* Clone this repository to an empty directory
|
||||||
```
|
```
|
||||||
git clone https://github.com/silverstripe/doc.silverstripe.org path/to/ssdocs
|
git clone https://github.com/silverstripe/doc.silverstripe.org path/to/ssdocs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker install
|
||||||
|
|
||||||
|
No local NodeJS nor gatsby-cli is required for this option.
|
||||||
|
|
||||||
|
* Make sure docker and docker-compose are installed and docker daemon is running
|
||||||
|
* Simply use `./docker/run` to run gatsby commands
|
||||||
|
- `./docker/run build` would be equal to run `gatsby build` within a container
|
||||||
|
- `./docker/run develop -p 8000` would run `gatsby develop -p 8000` within a container.
|
||||||
|
|
||||||
|
### Native install
|
||||||
|
|
||||||
|
* Install [Gatsby CLI](https://gatsbyjs.com)
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
To test a static build of the site, first create a production environment file.
|
To test a static build of the site, first create a production environment file.
|
||||||
|
@ -55,7 +67,7 @@ From within `path/to/ssdocs`, run the command
|
||||||
gatsby develop
|
gatsby develop
|
||||||
```
|
```
|
||||||
to instantiate a development server. This will consume all of the markdown files in both major release
|
to instantiate a development server. This will consume all of the markdown files in both major release
|
||||||
branches and allow you to browse the documentation site on `http://localhost:8000` by default
|
branches and allow you to browse the documentation site on `http://localhost:8000` by default
|
||||||
(see the [Gatsby docs](https://www.gatsbyjs.org/docs/) for instructions on customising the port).
|
(see the [Gatsby docs](https://www.gatsbyjs.org/docs/) for instructions on customising the port).
|
||||||
|
|
||||||
## Authoring
|
## Authoring
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
FROM node:12
|
||||||
|
|
||||||
|
RUN yarn global add gatsby-cli
|
|
@ -0,0 +1,15 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
x-entrypoint: &entry
|
||||||
|
- /bin/bash
|
||||||
|
- /app/docker/entrypoint.sh
|
||||||
|
|
||||||
|
services:
|
||||||
|
gatsby:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
working_dir: /app
|
||||||
|
network_mode: "host"
|
||||||
|
volumes:
|
||||||
|
- '..:/app'
|
||||||
|
entrypoint: *entry
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /app;
|
||||||
|
|
||||||
|
if [[ ! -d "/app/node_modules" ]] ; then
|
||||||
|
yarn;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
gatsby $@
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd $(dirname $0) && docker-compose run -u $(id -u) --rm gatsby $@
|
Loading…
Reference in New Issue