Skip to content

Commit

Permalink
[Issue #1510]: Split FE / BE docker-compose (#1513)
Browse files Browse the repository at this point in the history
## Summary
Fixes #1510

## Changes proposed
- Move `nextjs` and `storybook` service to
`./frontend/docker-compose.yml`
- Move `grants-api` and `grants-db` service to
`./api/docker-compose.yml`
- Top level `./docker-compose.yml`
  • Loading branch information
rylew1 authored Mar 21, 2024
1 parent 4b5adea commit 84a593f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 62 deletions.
33 changes: 33 additions & 0 deletions api/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3'

services:

grants-db:
image: postgres:14-alpine
container_name: grants-db
command: postgres -c "log_lock_waits=on" -N 1000 -c "fsync=off"
env_file: ./local.env
ports:
- "5432:5432"
volumes:
- grantsdbdata:/var/lib/postgresql/data

grants-api:
build:
context: .
target: dev
args:
- RUN_UID=${RUN_UID:-4000}
- RUN_USER=${RUN_USER:-api}
command: ["poetry", "run", "flask", "--app", "src.app", "run", "--host", "0.0.0.0", "--port", "8080", "--reload"]
container_name: grants-api
env_file: ./local.env
ports:
- 8080:8080
volumes:
- .:/api
depends_on:
- grants-db

volumes:
grantsdbdata:
67 changes: 5 additions & 62 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,8 @@
version: '3'

services:
include:
- path: ./api/docker-compose.yml
- path: ./frontend/docker-compose.yml

grants-db:
image: postgres:14-alpine
container_name: grants-db
command: postgres -c "log_lock_waits=on" -N 1000 -c "fsync=off"
env_file: ./api/local.env
ports:
- "5432:5432"
volumes:
- grantsdbdata:/var/lib/postgresql/data

grants-api:
build:
context: ./api
target: dev
args:
- RUN_UID=${RUN_UID:-4000}
- RUN_USER=${RUN_USER:-api}
command: ["poetry", "run", "flask", "--app", "src.app", "run", "--host", "0.0.0.0", "--port", "8080", "--reload"]
container_name: grants-api
env_file: ./api/local.env
ports:
- 8080:8080
volumes:
- ./api:/api
depends_on:
- grants-db

nextjs:
container_name: next-dev
build:
context: ./frontend
target: dev
env_file:
# Add your non-secret environment variables to this file:
- ./frontend/.env.development
# If you have secrets, add them to this file and uncomment this line:
# - ./frontend/.env.local
volumes:
- ./frontend/src:/frontend/src
- ./frontend/public:/frontend/public
restart: always
ports:
- 3000:3000

storybook:
container_name: storybook
build:
context: ./frontend
target: dev
command: npm run storybook
volumes:
- ./frontend/src:/frontend/src
- ./frontend/public:/frontend/public
- ./frontend/.storybook:/frontend/.storybook
- ./frontend/stories:/frontend/stories
restart: always
ports:
- 6006:6006

volumes:
grantsdbdata:
# services:
# Define other services or override configurations
31 changes: 31 additions & 0 deletions frontend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3"

services:
nextjs:
container_name: next-dev
build:
context: .
target: dev
env_file:
- ./.env.development
volumes:
- ./src:/frontend/src
- ./public:/frontend/public
restart: always
ports:
- 3000:3000

storybook:
container_name: storybook
build:
context: .
target: dev
command: npm run storybook
volumes:
- ./src:/frontend/src
- ./public:/frontend/public
- ./.storybook:/frontend/.storybook
- ./stories:/frontend/stories
restart: always
ports:
- 6006:6006

0 comments on commit 84a593f

Please sign in to comment.