-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
49 lines (46 loc) · 1.16 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
version: '3.3'
services:
app:
image: golang:1.22.4-alpine3.20
container_name: golang_container
env_file:
- .env
environment:
- POSTGRES_HOST=postgresdb
build:
context: .
dockerfile: Dockerfile
ports:
- 8080:${SERVER_PORT}
restart: on-failure
volumes:
- .:/app
working_dir: /app
command: "go run /app/main.go"
depends_on:
- postgresdb
postgresdb:
image: postgres:latest
restart: always
env_file:
- .env
container_name: postgres_container
ports:
- '1234:${POSTGRES_PORT}'
volumes:
- postgres-data-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 3s
retries: 5
migrate:
image: migrate/migrate
container_name: migrate_container
volumes:
- ./migrations:/migrations
command: ["-path", "/migrations", "-database", "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgresdb:${POSTGRES_PORT}/${POSTGRES_DB}?sslmode=disable", "up", "3"]
depends_on:
- postgresdb
volumes:
postgres-data-volume: