codenuk_backend_mine/services/git-integration/Dockerfile
2025-09-26 17:04:14 +05:30

36 lines
792 B
Docker

FROM node:18-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Install git and tools required for healthchecks and HTTPS clones
RUN apk add --no-cache git curl ca-certificates openssh-client && update-ca-certificates
# Copy source code
COPY . .
# Create non-root user
RUN addgroup -g 1001 -S nodejs
RUN adduser -S git-integration -u 1001
# Create git-repos directory and set proper permissions
RUN mkdir -p /app/git-repos
RUN chown -R git-integration:nodejs /app
RUN chmod -R 755 /app/git-repos
USER git-integration
# Expose port
EXPOSE 8012
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8012/health || exit 1
# Start the application
CMD ["npm", "start"]