Files
fullstack-portfolio/docker-compose.yml
2026-03-10 11:28:37 +07:00

39 lines
1.2 KiB
YAML

services:
app:
image: git.exavolt.web.id/fikri/fullstack-portfolio:latest
container_name: fikri-portfolio-app
restart: always
ports:
- "4000:4000"
# OPTIMASI 1: Cukup gunakan env_file atau environment, jangan keduanya untuk variabel yang sama
# Jika variabel sudah ada di .env, Docker akan otomatis memetakan ke container.
env_file:
- .env
environment:
# OPTIMASI 2: Set Node Environment ke production untuk performa lebih cepat
NODE_ENV: production
PORT: 4000
# OPTIMASI 3: Resources Limit (Mencegah VPS hang jika ada memory leak)
deploy:
resources:
limits:
memory: 512M
extra_hosts:
- "host.docker.internal:host-gateway"
# OPTIMASI 4: Logging limit agar disk VPS tidak penuh oleh log docker
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# OPTIMASI 5: Migrasi Database
# Jika image Anda sudah sangat minimal (alpine), pastikan npx tersedia.
# Lebih baik migrasi dilakukan di tahap CI atau via script init.
command: >
sh -c "npx prisma migrate deploy && node server.js"