- Add wget installation for healthcheck - Increase healthcheck timeout to 10s - Increase start-period to 10s - Simplify to Node.js only (remove Go builder stage)
37 lines
933 B
Docker
37 lines
933 B
Docker
# =============================================================================
|
|
# GoHorse Jobs Seeder API - Production Dockerfile (Node.js only)
|
|
# =============================================================================
|
|
|
|
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
|
|
|
|
# Copy seeders and SQL assets
|
|
COPY src/ ./src/
|
|
COPY sql/ ./sql/
|
|
|
|
# Security: Run as non-root
|
|
RUN addgroup -g 1001 -S nodejs && \
|
|
adduser -u 1001 -S seeder -G nodejs && \
|
|
chown -R seeder:nodejs /app
|
|
|
|
USER seeder
|
|
|
|
# Environment
|
|
ENV NODE_ENV=production \
|
|
PORT=8080
|
|
|
|
EXPOSE 8080
|
|
|
|
# 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"]
|