Root: - Add comprehensive .gitignore covering all subprojects Seeder API (Node.js): - Add Dockerfile with multi-stage build, non-root user, health check - Add .dockerignore and .gitignore Job Scraper (Python): - Add Dockerfile with Python 3.12, non-root user - Add .dockerignore and .gitignore Existing backend/frontend Dockerfiles and .dockerignore already optimized
33 lines
777 B
Docker
33 lines
777 B
Docker
# =============================================================================
|
|
# GoHorse Jobs Seeder API - Production Dockerfile
|
|
# =============================================================================
|
|
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
COPY package*.json ./
|
|
RUN npm ci --only=production && npm cache clean --force
|
|
|
|
# Copy source
|
|
COPY src/ ./src/
|
|
|
|
# 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=3001
|
|
|
|
EXPOSE 3001
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget -qO- http://localhost:3001/health || exit 1
|
|
|
|
CMD ["node", "src/index.js"]
|