mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-15 01:01:43 +10:00
Docker changes
Added: Healthchecks Changed Postgres to Alpine + pinned Pinned Traefik Version Made Env Vars easier to see + change/reference for those using their own env file.
This commit is contained in:
@ -49,4 +49,7 @@ EXPOSE 3000
|
|||||||
|
|
||||||
ENV PORT 3000
|
ENV PORT 3000
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=20s --retries=3 --start-period=15s \
|
||||||
|
CMD curl -fSs 127.0.0.1:3000 || exit 1
|
||||||
|
|
||||||
CMD [ "pnpm", "run", "start:client" ]
|
CMD [ "pnpm", "run", "start:client" ]
|
||||||
@ -2,7 +2,7 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres
|
image: postgres:14.2-alpine
|
||||||
container_name: postgres
|
container_name: postgres
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
@ -10,6 +10,13 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./scripts/database/initialize.sql:/docker-entrypoint-initdb.d/initialize.sql
|
- ./scripts/database/initialize.sql:/docker-entrypoint-initdb.d/initialize.sql
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres" ]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 30s
|
||||||
|
start_period: 15s
|
||||||
|
retries: 3
|
||||||
|
restart: always
|
||||||
|
|
||||||
traefik:
|
traefik:
|
||||||
image: traefik
|
image: traefik
|
||||||
|
|||||||
@ -2,16 +2,26 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres
|
image: postgres:14.2-alpine
|
||||||
container_name: postgres
|
container_name: postgres
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
env_file: .env
|
environment:
|
||||||
|
- POSTGRES_USER="postgres"
|
||||||
|
- POSTGRES_PASSWORD="postgres"
|
||||||
|
- POSTGRES_DATABASE="postgres"
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres" ]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 30s
|
||||||
|
start_period: 15s
|
||||||
|
retries: 3
|
||||||
|
restart: always
|
||||||
|
|
||||||
traefik:
|
traefik:
|
||||||
image: traefik
|
image: traefik:rocamadour
|
||||||
container_name: traefik
|
container_name: traefik
|
||||||
command:
|
command:
|
||||||
- --providers.docker=true
|
- --providers.docker=true
|
||||||
@ -25,9 +35,25 @@ services:
|
|||||||
server:
|
server:
|
||||||
image: amruthpillai/reactive-resume:server-latest
|
image: amruthpillai/reactive-resume:server-latest
|
||||||
container_name: server
|
container_name: server
|
||||||
env_file: .env
|
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_HOST=postgres
|
- TZ="UTC"
|
||||||
|
- SECRET_KEY=""
|
||||||
|
- PUBLIC_URL="http://<SERVER-IP>"
|
||||||
|
- POSTGRES_HOST="postgres"
|
||||||
|
- POSTGRES_PORT="5432"
|
||||||
|
- POSTGRES_USERNAME="postgres"
|
||||||
|
- POSTGRES_PASSWORD="postgres"
|
||||||
|
- POSTGRES_DATABASE="postgres"
|
||||||
|
- POSTGRES_SSL_CERT=""
|
||||||
|
- JWT_SECRET=""
|
||||||
|
- JWT_EXPIRY_TIME="604800"
|
||||||
|
- PUBLIC_GOOGLE_CLIENT_ID=""
|
||||||
|
- GOOGLE_CLIENT_SECRET=""
|
||||||
|
- GOOGLE_API_KEY=""
|
||||||
|
- SENDGRID_API_KEY="" # Optional
|
||||||
|
- SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID="" # Optional
|
||||||
|
- SENDGRID_FROM_NAME="" # Optional
|
||||||
|
- SENDGRID_FROM_EMAIL="" # Optional
|
||||||
depends_on:
|
depends_on:
|
||||||
- traefik
|
- traefik
|
||||||
- postgres
|
- postgres
|
||||||
@ -38,11 +64,16 @@ services:
|
|||||||
- traefik.http.routers.server.middlewares=server-stripprefix
|
- traefik.http.routers.server.middlewares=server-stripprefix
|
||||||
- traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
|
- traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
|
||||||
- traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true
|
- traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true
|
||||||
|
restart: always
|
||||||
|
|
||||||
client:
|
client:
|
||||||
image: amruthpillai/reactive-resume:client-latest
|
image: amruthpillai/reactive-resume:client-latest
|
||||||
container_name: client
|
container_name: client
|
||||||
env_file: .env
|
environment:
|
||||||
|
- TZ="UTC"
|
||||||
|
- PUBLIC_URL="http://<SERVER-IP>"
|
||||||
|
- PUBLIC_SERVER_URL="http://<SERVER-IP>/api"
|
||||||
|
- PUBLIC_GOOGLE_CLIENT_ID=""
|
||||||
depends_on:
|
depends_on:
|
||||||
- traefik
|
- traefik
|
||||||
- server
|
- server
|
||||||
@ -50,6 +81,7 @@ services:
|
|||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.client.rule=Host(`<SERVER-IP>`)
|
- traefik.http.routers.client.rule=Host(`<SERVER-IP>`)
|
||||||
- traefik.http.routers.client.entrypoints=web
|
- traefik.http.routers.client.entrypoints=web
|
||||||
|
restart: always
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
|
|||||||
@ -47,4 +47,7 @@ EXPOSE 3100
|
|||||||
|
|
||||||
ENV PORT 3100
|
ENV PORT 3100
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=20s --retries=3 --start-period=15s \
|
||||||
|
CMD curl -fSs localhost:3100/health || exit 1
|
||||||
|
|
||||||
CMD [ "pnpm", "run", "start:server" ]
|
CMD [ "pnpm", "run", "start:server" ]
|
||||||
Reference in New Issue
Block a user