mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
Add docker support for development environment
This commit is contained in:
parent
ca4383b113
commit
8609a09f4b
14
README.md
14
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.
|
||||||
|
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…
x
Reference in New Issue
Block a user