Files
hireflow/docker-compose.yml
ryan.gogo 7b2c5f312c Fix: Use Coolify's SOURCE_COMMIT instead of git detection
Research findings:
- Coolify provides SOURCE_COMMIT environment variable with git commit hash
- Must enable "Include Source Commit in Build" in Coolify General settings
- Disabled by default to preserve Docker build cache
- Coolify automatically passes SOURCE_COMMIT as build arg

Changes:
1. Dockerfile: Use SOURCE_COMMIT build arg instead of GIT_COMMIT
2. Dockerfile: Remove git installation and detection logic
3. Dockerfile: Extract first 7 chars of SOURCE_COMMIT for short hash
4. docker-compose.yml: Pass SOURCE_COMMIT instead of GIT_COMMIT
5. docker-compose.yml: Remove GIT_COMMIT from env (set in Dockerfile)
6. README: Add instructions to enable "Include Source Commit in Build"
7. README: Update version tracking documentation

How it works:
- Coolify passes SOURCE_COMMIT to docker build
- Dockerfile takes first 7 characters: ${SOURCE_COMMIT:0:7}
- Sets as GIT_COMMIT env var for runtime
- Health endpoint returns the short commit ID

Note: Returns "unknown" if SOURCE_COMMIT tracking is not enabled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-15 14:02:43 +01:00

89 lines
2.1 KiB
YAML

version: '3.8'
services:
app:
build:
context: .
args:
SOURCE_COMMIT: ${SOURCE_COMMIT:-unknown}
APP_VERSION: ${APP_VERSION:-1.0.0}
restart: unless-stopped
environment:
- NODE_ENV=production
- PORT=3000
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=template_db
- REDIS_HOST=redis
- REDIS_PORT=6379
- APP_VERSION=${APP_VERSION:-1.0.0}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- app-network
expose:
- "3000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 10s
timeout: 3s
start_period: 5s
retries: 2
labels:
- "traefik.enable=true"
- "traefik.http.routers.template-001.rule=Host(`template-001.startanaicompany.com`)"
- "traefik.http.routers.template-001.entrypoints=websecure"
- "traefik.http.routers.template-001.tls=true"
- "traefik.http.routers.template-001.tls.certresolver=letsencrypt"
- "traefik.http.services.template-001.loadbalancer.server.port=3000"
postgres:
image: postgres:15-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=template_db
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- app-network
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 3
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis-data:/data
networks:
- app-network
expose:
- "6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 3
volumes:
postgres-data:
driver: local
redis-data:
driver: local
networks:
app-network:
driver: bridge