feat: add Docker containerization setup
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>
This commit is contained in:
36
docker/Dockerfile.worker
Normal file
36
docker/Dockerfile.worker
Normal file
@@ -0,0 +1,36 @@
|
||||
# Worker Service Dockerfile
|
||||
FROM golang:1.21-alpine AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy go workspace
|
||||
COPY go.work* ./
|
||||
COPY go.mod* ./services/worker/
|
||||
COPY go.sum* ./services/worker/ 2>/dev/null || true
|
||||
|
||||
# Copy shared packages
|
||||
COPY pkg/ ./pkg/
|
||||
|
||||
# Copy service
|
||||
COPY services/worker/ ./services/worker/
|
||||
|
||||
# Build
|
||||
WORKDIR /build/services/worker
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app/worker .
|
||||
|
||||
# Final image
|
||||
FROM alpine:3.18
|
||||
|
||||
RUN apk --no-cache add ca-certificates curl
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/worker .
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8081/health || exit 1
|
||||
|
||||
EXPOSE 8081
|
||||
|
||||
CMD ["/app/worker"]
|
||||
Reference in New Issue
Block a user