merge services api and nginx
This commit is contained in:
@@ -37,18 +37,64 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- web-network
|
- web-network
|
||||||
- internal
|
- internal
|
||||||
- serv_golang_rest_api_app-network # сеть API
|
- app-network
|
||||||
depends_on:
|
depends_on:
|
||||||
- certbot
|
- certbot
|
||||||
|
|
||||||
|
api:
|
||||||
|
build:
|
||||||
|
context: ./serv_golang_rest_api
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8888:8080"
|
||||||
|
container_name: serv_golang_rest_api
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
# Database connection settings
|
||||||
|
DB_HOST: db
|
||||||
|
DB_PORT: 5432
|
||||||
|
DB_USER: postgres
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
DB_NAME: mydb
|
||||||
|
APP_PORT: 8080
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
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
|
||||||
|
- ./migrations:/docker-entrypoint-initdb.d
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
certbot_data:
|
certbot_data:
|
||||||
certbot_www:
|
certbot_www:
|
||||||
|
postgres_data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
web-network:
|
web-network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
internal:
|
internal:
|
||||||
serv_golang_rest_api_app-network:
|
app-network:
|
||||||
external: true
|
|
||||||
name: serv_golang_rest_api_app-network
|
name: serv_golang_rest_api_app-network
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
api:
|
api:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ./serv_golang_rest_api
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8888:8080"
|
- "8888:8080"
|
||||||
Reference in New Issue
Block a user