-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add postgres service to docker compose (#13)
* docs: add setup instructions to README * build: add docker compose for local postgres * docs: document new docker compose files
- Loading branch information
Showing
3 changed files
with
72 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
# Basically dev.local.docker-compose.yml, but with postgres | ||
services: | ||
backend: | ||
image: api | ||
build: | ||
context: ../answerbook-api | ||
dockerfile: dev.Dockerfile | ||
command: poetry run uvicorn main:app --reload --host 0.0.0.0 --port 5004 | ||
extends: | ||
file: dev.local.docker-compose.yml | ||
service: backend | ||
environment: | ||
- DB_URL=postgresql://user:[email protected]/answerbook | ||
volumes: | ||
- ../answerbook-api:/api | ||
ports: | ||
- 127.0.0.1:5004:5004 | ||
|
||
- DB_URL=postgresql://user:pass@db/answerbook | ||
|
||
frontend: | ||
image: node:20.13 | ||
ports: | ||
- 127.0.0.1:3000:3000 | ||
working_dir: /ui | ||
volumes: | ||
- ./:/ui | ||
command: npm start | ||
extends: | ||
file: dev.local.docker-compose.yml | ||
service: frontend | ||
|
||
# add db | ||
db: | ||
image: postgres:15 | ||
environment: | ||
- REACT_APP_API_ENTRYPOINT=http://localhost:5004 | ||
depends_on: | ||
- backend | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: pass | ||
POSTGRES_DB: answerbook | ||
volumes: | ||
- answerbook-api-pgdata:/var/lib/postgresql/data | ||
|
||
volumes: | ||
answerbook-api-pgdata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Run answerbook in docker but use a host-based postgres database | ||
|
||
services: | ||
backend: | ||
image: api | ||
build: | ||
context: ../answerbook-api | ||
dockerfile: dev.Dockerfile | ||
command: poetry run uvicorn main:app --reload --host 0.0.0.0 --port 5004 | ||
environment: | ||
- DB_URL=postgresql://user:[email protected]/answerbook | ||
volumes: | ||
- ../answerbook-api:/api | ||
ports: | ||
- 127.0.0.1:5004:5004 | ||
|
||
frontend: | ||
image: node:20.13 | ||
ports: | ||
- 127.0.0.1:3000:3000 | ||
working_dir: /ui | ||
volumes: | ||
- ./:/ui | ||
command: npm start | ||
environment: | ||
- REACT_APP_API_ENTRYPOINT=http://localhost:5004 | ||
depends_on: | ||
- backend |