mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 17:05:50 +02:00
Merge pull request #207 from creative-commoners/feature/docker
Add docker support for development environment
This commit is contained in:
commit
4fa94b50d0
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):
|
||||
|
||||
* Install [Gatsby CLI](https://gatsbyjs.com)
|
||||
* Clone this repository to an empty directory
|
||||
```
|
||||
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
|
||||
|
||||
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
|
||||
```
|
||||
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).
|
||||
|
||||
## Authoring
|
||||
|
3
docker/Dockerfile
Normal file
3
docker/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM node:12
|
||||
|
||||
RUN yarn global add gatsby-cli
|
15
docker/docker-compose.yml
Normal file
15
docker/docker-compose.yml
Normal file
@ -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
|
9
docker/entrypoint.sh
Normal file
9
docker/entrypoint.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /app;
|
||||
|
||||
if [[ ! -d "/app/node_modules" ]] ; then
|
||||
yarn;
|
||||
fi;
|
||||
|
||||
gatsby $@
|
3
docker/run
Executable file
3
docker/run
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0) && docker-compose run -u $(id -u) --rm gatsby $@
|
Loading…
Reference in New Issue
Block a user