fix: improve seeder Dockerfile healthcheck

- Add wget installation for healthcheck
- Increase healthcheck timeout to 10s
- Increase start-period to 10s
- Simplify to Node.js only (remove Go builder stage)
This commit is contained in:
Tiago Yamamoto 2026-02-16 11:44:02 -06:00
parent e2b2f303e7
commit 31bac38f19

View file

@ -1,21 +1,14 @@
# =============================================================================
# GoHorse Jobs Seeder API - Production Dockerfile (Go API + Node seeders)
# GoHorse Jobs Seeder API - Production Dockerfile (Node.js only)
# =============================================================================
FROM mirror.gcr.io/library/golang:1.22-alpine AS go-builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /seeder-api
FROM mirror.gcr.io/library/node:20-alpine
FROM node:20-alpine
WORKDIR /app
# Install wget for healthcheck
RUN apk add --no-cache wget
# Install Node.js dependencies for seed scripts
COPY package*.json ./
RUN npm ci --only=production && npm cache clean --force
@ -24,9 +17,6 @@ RUN npm ci --only=production && npm cache clean --force
COPY src/ ./src/
COPY sql/ ./sql/
# Copy Go API binary
COPY --from=go-builder /seeder-api /usr/local/bin/seeder-api
# Security: Run as non-root
RUN addgroup -g 1001 -S nodejs && \
adduser -u 1001 -S seeder -G nodejs && \
@ -40,8 +30,8 @@ ENV NODE_ENV=production \
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
# Health check with longer timeout
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:8080/health || exit 1
CMD ["node", "src/server.js"]