build(docker): make Compose file more configurable
Allow for configuring volume mounts, ports, the site URL, and volume mounts within the Docker Compose file using environment variables from within and .env file. This means that the same Docker Compose file could be used to generate and serve the site locally using an anonymous volume, as well as generate a one-time build into a local directory to be served by Apache or Nginx on production.
This commit is contained in:
parent
e736230805
commit
7fbecb1728
4 changed files with 39 additions and 26 deletions
|
@ -1,34 +1,20 @@
|
|||
version: '2.4'
|
||||
|
||||
services:
|
||||
proxy:
|
||||
image: nginxproxy/nginx-proxy:alpine
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
ports:
|
||||
- "${DOCKER_WEB_PORT_FORWARD:-80}:80"
|
||||
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: tools/docker/images/Dockerfile
|
||||
target: app
|
||||
expose:
|
||||
- 80
|
||||
command:
|
||||
- generate
|
||||
- --server
|
||||
- --watch
|
||||
- --port
|
||||
- '80'
|
||||
- --url
|
||||
- http://oliverdavies.localhost
|
||||
command: generate --port "${SCULPIN_PORT:-80}" --url "${SCULPIN_URL:-http://localhost}" --env "${SCULPIN_ENV:-dev}" "${SCULPIN_GENERATE_ARGS}"
|
||||
volumes:
|
||||
- assets:/app/source/build
|
||||
- /app/output_dev
|
||||
- .:/app
|
||||
environment:
|
||||
VIRTUAL_HOST: oliverdavies.localhost
|
||||
- "${DOCKER_OUTPUT_VOLUME:-./output_prod:/app/output_prod}"
|
||||
ports:
|
||||
- "${SCULPIN_PORT:-80}:${SCULPIN_PORT:-80}"
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
- assets
|
||||
|
||||
assets:
|
||||
image: node:14
|
||||
|
@ -50,4 +36,4 @@ services:
|
|||
- assets-watch
|
||||
|
||||
volumes:
|
||||
assets:
|
||||
assets: {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue