oliverdavies.uk/docker-compose.yaml
Oliver Davies 7fbecb1728 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.
2021-10-26 22:48:26 +01:00

40 lines
1.1 KiB
YAML

services:
app:
build:
context: .
dockerfile: tools/docker/images/Dockerfile
target: app
command: generate --port "${SCULPIN_PORT:-80}" --url "${SCULPIN_URL:-http://localhost}" --env "${SCULPIN_ENV:-dev}" "${SCULPIN_GENERATE_ARGS}"
volumes:
- assets:/app/source/build
- .:/app
- "${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
volumes:
- assets:/node/source/build
- /node/node_modules
- ./assets:/node/assets
- ./Makefile:/node/Makefile
- ./package.json:/node/package.json
- ./package-lock.json:/node/package-lock.json
- ./postcss.config.js:/node/postcss.config.js
- ./source:/node/source
- ./tailwind.config.js:/node/tailwind.config.js
- ./tools/tailwindcss:/node/tools/tailwindcss
- ./webpack.config.js:/node/webpack.config.js
working_dir: /node
entrypoint: make
command:
- assets-watch
volumes:
assets: {}