Skip to content

Commit

Permalink
Feat: added volume, network and port to docker compose (#814)
Browse files Browse the repository at this point in the history
Fixes issue where containers cannot to talk to each other where the
default docker network is isolated.
  • Loading branch information
djpiper28 committed Aug 28, 2024
1 parent 33efece commit a2f63ab
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 34 deletions.
72 changes: 43 additions & 29 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,48 @@
version: '3.1'

networks:
bracket_lan:
driver: bridge

volumes:
bracket_pg_data:


services:
bracket-frontend:
image: ghcr.io/evroon/bracket-frontend
container_name: bracket-frontend
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_BASE_URL: "http://localhost:8400"
NEXT_PUBLIC_HCAPTCHA_SITE_KEY: "10000000-ffff-ffff-ffff-000000000001" # Public test key
restart: unless-stopped
bracket-backend:
container_name: bracket-backend
depends_on:
- postgres
environment:
ENVIRONMENT: DEVELOPMENT
PG_DSN: postgresql://bracket_dev:bracket_dev@postgres:5432/bracket_dev
image: ghcr.io/evroon/bracket-backend
networks:
- bracket_lan
ports:
- 8400:8400
restart: unless-stopped
volumes:
- ./backend/static:/app/static

bracket-backend:
image: ghcr.io/evroon/bracket-backend
container_name: bracket-backend
ports:
- "8400:8400"
environment:
ENVIRONMENT: "DEVELOPMENT"
PG_DSN: "postgresql://bracket_dev:bracket_dev@postgres:5432/bracket_dev"
volumes:
- ./backend/static:/app/static
restart: unless-stopped
depends_on:
- postgres
bracket-frontend:
container_name: bracket-frontend
environment:
NEXT_PUBLIC_API_BASE_URL: http://localhost:8400
NEXT_PUBLIC_HCAPTCHA_SITE_KEY: 10000000-ffff-ffff-ffff-000000000001
image: ghcr.io/evroon/bracket-frontend
ports:
- 3000:3000
restart: unless-stopped

postgres:
image: postgres
restart: always
environment:
POSTGRES_DB: bracket_dev
POSTGRES_USER: bracket_dev
POSTGRES_PASSWORD: bracket_dev
postgres:
environment:
POSTGRES_DB: bracket_dev
POSTGRES_PASSWORD: bracket_dev
POSTGRES_USER: bracket_dev
image: postgres
networks:
- bracket_lan
restart: always
volumes:
- bracket_pg_data:/var/lib/postgresql/data
11 changes: 6 additions & 5 deletions docs/docs/deployment/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ services:
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_BASE_URL: "https://bracket.mywebsite.com"
# Go to https://dashboard.hcaptcha.com/signup, create a site and put the site key here
NEXT_PUBLIC_HCAPTCHA_SITE_KEY: "xxxxx"
NODE_ENV: "production"
NEXT_PUBLIC_API_BASE_URL: "http://your-site.com:8400"
NEXT_PUBLIC_HCAPTCHA_SITE_KEY: "10000000-ffff-ffff-ffff-000000000001" # Public test key
restart: unless-stopped

bracket-backend:
Expand All @@ -31,8 +29,11 @@ services:
environment:
ENVIRONMENT: "PRODUCTION"
PG_DSN: "postgresql://bracket_prod:bracket_prod@postgres:5432/bracket_prod"
CORS_ORIGINS: https://your-site.com
CORS_ORIGIN_REGEX: ^https://your-site.com$
JWT_SECRET: change_me
volumes:
- ./backend/static:/app/static
- ./backend/static:/app/static
restart: unless-stopped
depends_on:
- postgres
Expand Down

0 comments on commit a2f63ab

Please sign in to comment.