add docker compose and update deployment manual

This commit is contained in:
renaldybrada
2026-03-16 09:53:53 +07:00
parent fbcea84daf
commit bc2265b747
2 changed files with 16 additions and 26 deletions

No files matched your search

+10 -19
View File
@@ -1,23 +1,14 @@
version: "3.9" version: "3.9"
services: services:
postgres: api:
image: postgres:16 container_name: antrian-operasi-api
container_name: antrian_operasi build:
restart: unless-stopped context: .
environment: dockerfile: Dockerfile
POSTGRES_USER: rssa image: antrianoperasi-api:latest
POSTGRES_PASSWORD: supersecret env_file:
POSTGRES_DB: antrian_operasi - .env
ports: ports:
- "5432:5432" - "8080:8080"
volumes: restart: unless-stopped
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rssa -d antrian_operasi"]
interval: 5s
timeout: 5s
retries: 5
volumes:
pgdata:
+6 -7
View File
@@ -88,14 +88,13 @@ cd <project_name>
go run ./migrations/seeder.go go run ./migrations/seeder.go
``` ```
## Docker ## Deployment
```bash ```bash
// masuk ke root project // 1. Sesuaikan environment di file .env
cd <project_name>
// build docker image // 2. Build dan run container
docker build -t antrianoperasi-api:latest . docker compose up -d --build
// run docker container // 3. Run container saja (case: .env saja yang berubah)
docker run -d --name antrian-operasi-api --env-file .env -p 8080:8080 antrianoperasi-api:latest docker compose up -d
``` ```