Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/update docker #24

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: secret
POSTGRES_DB: rdb
POSTGRES_DB: rbd
ports:
- 5432:5432
options: >-
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!make
DB_SOURCE=postgresql://root:secret@localhost:5432/rdb?sslmode=disable
DB_SOURCE=postgresql://root:secret@localhost:5432/rbd?sslmode=disable

postgres:
docker run --name postgres --network bank-network -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres:14-alpine
createdb:
docker exec -it postgres createdb --username=root --owner=root rbd
dropdb:
docker exec -it postgres dropdb rdb
docker exec -it postgres dropdb rbd

migrateup:
migrate -path db/migrations -database "$(DB_SOURCE)" -verbose up
Expand Down
2 changes: 1 addition & 1 deletion app.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REDIS_ADDRESS=0.0.0.0:6379
ENVIRONMENT=development
DB_SOURCE=postgresql://root:secret@localhost:5432/rdb?sslmode=disable
DB_SOURCE=postgresql://root:secret@localhost:5432/rbd?sslmode=disable
MIGRATION_URL=file://db/migrations
HTTP_SERVER_ADDRESS=0.0.0.0:8080
GRPC_SERVER_ADDRESS=0.0.0.0:9090
Expand Down
15 changes: 13 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ services:
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=rdb
- POSTGRES_DB=rbd
ports:
- "5432:5432"
volumes:
- data-rbd:var/lib/postgresql/data
redis:
image: redis:7-alpine
api:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
- "9090:9090"
environment:
- DB_SOURCE=postgresql://root:secret@postgres:5432/rdb?sslmode=disable
- DB_SOURCE=postgresql://root:secret@postgres:5432/rbd?sslmode=disable
- REDIS_ADDRESS=0.0.0.0:6379
depends_on:
- postgres
- redis
entrypoint:
[
"/app/wait-for.sh",
Expand All @@ -23,3 +32,5 @@ services:
"/app/start.sh"
]
command: [ "/app/main" ]
volumes:
data-volume: