JUNOHUB-test/docker-compose.ec2.yml
talatops d38398faeb fix: use immutable image tags for EC2 deploy
Use github.sha-based image tags in the deployment workflow and compose file so each pipeline run deploys a fresh app image instead of reusing mutable latest.
2026-03-30 21:04:24 +05:00

50 lines
1.7 KiB
YAML

services:
db:
# Use a Postgres image with pgvector preinstalled so we can enable the `vector` extension
image: pgvector/pgvector:pg17
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
POSTGRES_DB: ${POSTGRES_DB:-dropshipping}
ports:
- "5444:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
# Ensure the pgvector extension is created on first database init
- ./prisma/init-pgvector.sql:/docker-entrypoint-initdb.d/init-pgvector.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
app:
# IMPORTANT: EC2 deploy copies only the compose file + env + image tar.
# Do not include `build:` here; otherwise Compose will look for a Dockerfile on EC2.
image: ${IMAGE_NAME:-junohub-app}:${IMAGE_TAG:-latest}
restart: always
ports:
- "3000:3000"
env_file:
- .env
environment:
# Override DATABASE_URL to use internal docker network hostname
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-dropshipping}?schema=public
NODE_ENV: production
volumes:
- ./public/uploads/supplier-products:/app/public/uploads/supplier-products
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
postgres_data: