1
0
peddlers-of-ketran/docker-compose.yml

96 lines
3.0 KiB
YAML

services:
peddlers-of-ketran:
profiles: [prod]
container_name: ketr.ketran
build:
context: .
dockerfile: Dockerfile
restart: always
env_file:
- .env
ports:
- 8930:8930
volumes:
- ./db:/db:rw
- ./server/routes:/server/routes:ro
working_dir: /server
environment:
- VITE_basePath=/ketr.ketran
peddlers-of-ketran-dev:
profiles: [dev]
container_name: ketr.ketran.dev
hostname: peddlers-server
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- ./server:/server:rw
- ./db:/db:rw
command: ["sh", "-c", "cd /server && npm install --no-audit --no-fund --silent && npm rebuild sqlite3 && npm run start:dev"]
ports:
- 8930:8930
environment:
- NODE_ENV=development
- VITE_basePath=/ketr.ketran
networks:
- peddlers-network
peddlers-client:
profiles: [dev]
container_name: ketr.client
hostname: peddlers-client
build:
context: .
dockerfile: Dockerfile
working_dir: /client
volumes:
- ./client:/client:rw
- ./certs:/certs:ro
ports:
- 3001:3001
- 3003:3003
environment:
- VITE_API_BASE=
- BROWSER=none
- HTTPS=true
- HOST=0.0.0.0
- PUBLIC_URL=/ketr.ketran
# Provide paths to TLS key/cert inside the container so Vite can present
# a certificate for the external hostname (e.g. battle-linux.ketrenos.com).
- VITE_HTTPS_KEY=/certs/battle.key
- VITE_HTTPS_CERT=/certs/battle.crt
env_file:
- .env
# Install deps then run vite directly to avoid using the npm wrapper which
# was receiving SIGTERM in the container and making the service appear to
# restart repeatedly.
command: ["bash", "-c", "cd /client && npm install --legacy-peer-deps --silent --no-audit --no-fund && ./node_modules/.bin/vite --host"]
networks:
- peddlers-network
peddlers-test:
profiles: [dev,test]
container_name: ketr.test
build:
context: .
dockerfile: Dockerfile.test
working_dir: /opt/puppeteer-test
# Mount the workspace so test artifacts (screenshots) are written back to host
volumes:
- ./:/workspace:rw
- ./tools/puppeteer-test:/opt/puppeteer-test:rw
- /dev/shm:/dev/shm
environment:
# Default to the client service hostname on the compose network so tests
# can reach the dev client without using host networking.
- TEST_URL=https://peddlers-client:3001/ketr.ketran/
- CHROME_PATH=/usr/bin/chromium
entrypoint: ["/bin/sh", "-c", "echo Waiting for $${TEST_URL:-https://localhost:3001/ketr.ketran/} to be reachable && \
for i in $(seq 1 10); do if curl -k -sSf $${TEST_URL:-https://localhost:3001/ketr.ketran/} >/dev/null 2>&1; then echo url up; break; else echo waiting...; sleep 0.5; fi; done; \
node test.js $${TEST_URL:-https://localhost:3001/ketr.ketran/}"]
networks:
- peddlers-network
networks:
peddlers-network:
driver: bridge