fix(docker): fix docker-compose for production grade deployments

This commit is contained in:
Amruth Pillai
2022-03-14 09:03:47 +01:00
parent e82e714e41
commit 57f7edc134
16 changed files with 199 additions and 236 deletions

View File

@ -8,7 +8,6 @@ services:
- 5432:5432
env_file: .env
volumes:
- ./scripts/database/initialize.sql:/docker-entrypoint-initdb.d/initialize.sql
- pgdata:/var/lib/postgresql/data
traefik:
@ -24,17 +23,11 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro
server:
# Production
# image: amruthpillai/reactive-resume:server-latest
# Development
build:
context: .
dockerfile: server/Dockerfile
image: amruthpillai/reactive-resume:server-latest
container_name: server
env_file: .env
environment:
- PUBLIC_URL=http://localhost
- PUBLIC_URL=http://<SERVER-IP>
- POSTGRES_HOST=postgres
depends_on:
- traefik
@ -42,29 +35,23 @@ services:
labels:
- traefik.enable=true
- traefik.http.routers.server.entrypoints=web
- traefik.http.routers.server.rule=Host(`localhost`) && PathPrefix(`/api/`)
- traefik.http.routers.server.rule=Host(`<SERVER-IP>`) && PathPrefix(`/api/`)
- traefik.http.routers.server.middlewares=server-stripprefix
- traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
- traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true
client:
# Production
# image: amruthpillai/reactive-resume:client-latest
# Development
build:
context: .
dockerfile: client/Dockerfile
image: amruthpillai/reactive-resume:client-latest
container_name: client
env_file: .env
environment:
- PUBLIC_SERVER_URL=http://localhost/api
- PUBLIC_SERVER_URL=http://<SERVER-IP>/api
depends_on:
- traefik
- server
labels:
- traefik.enable=true
- traefik.http.routers.client.rule=Host(`localhost`)
- traefik.http.routers.client.rule=Host(`<SERVER-IP>`)
- traefik.http.routers.client.entrypoints=web
volumes: