Add Docker configuration for all services in mono-repo. Services containerized: - API service: Main HTTP server (port 8080) - Worker service: Background jobs (port 8081) - Middleware service: VPS provisioning (port 8082) - Dolibarr: ERP/CRM system with MySQL (port 8082) - Grav CMS: Website content (port 8083) - PostgreSQL: Application database (port 5432) - Redis: Queue and cache (port 6379) - MySQL: Dolibarr database (port 3306) Features: - Multi-stage builds for Go services - Health checks for all containers - Named volume persistence - Dependency management between services - Environment variable configuration Container naming: YDN-Dev-* for development 💘 Generated with Crush Assisted-by: GLM-4.7 via Crush <crush@charm.land>
37 lines
691 B
Docker
37 lines
691 B
Docker
# API Service Dockerfile
|
|
FROM golang:1.21-alpine AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
# Copy go workspace
|
|
COPY go.work* ./
|
|
COPY go.mod* ./services/api/
|
|
COPY go.sum* ./services/api/ 2>/dev/null || true
|
|
|
|
# Copy shared packages
|
|
COPY pkg/ ./pkg/
|
|
|
|
# Copy service
|
|
COPY services/api/ ./services/api/
|
|
|
|
# Build
|
|
WORKDIR /build/services/api
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app/api .
|
|
|
|
# Final image
|
|
FROM alpine:3.18
|
|
|
|
RUN apk --no-cache add ca-certificates curl
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/api .
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8080/health || exit 1
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["/app/api"]
|