modified: docker-compose.yaml

modified:   go.mod
	modified:   go.sum
	modified:   main.go
add db for rest api
This commit is contained in:
2025-09-25 04:55:27 +05:00
parent c2c48f5f9c
commit 2c07fba277
4 changed files with 122 additions and 2 deletions
+31 -1
View File
@@ -6,4 +6,34 @@ services:
ports:
- "8888:8080"
container_name: serv_golang_rest_api
restart: unless-stopped
restart: unless-stopped
depends_on:
- db
environment:
# Database connection settings
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: mydb
networks:
- app-network
db:
image: postgres:15-alpine
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: mydb
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- app-network
volumes:
postgres_data:
networks:
app-network: