chore(docker): optimize Dockerfiles and add healthchecks for Coolify deployment
- Add build arguments and environment variables for OAuth client IDs in frontend Dockerfile - Install wget and add HEALTHCHECK commands to frontend and backend Dockerfiles - Create non-root user in backend Dockerfile for improved security - Update docker-compose.yml with healthcheck configurations and dynamic port/environment variable support - Add network configuration and restart policies to docker-compose services - Expand .env.example with additional OAuth secrets, ports, and environment variables for Coolify - Enhance README.md with detailed Coolify deployment instructions and required environment variables table
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Backend Dockerfile
|
||||
# Backend Dockerfile (Coolify Optimized)
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
@@ -20,6 +20,9 @@ FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install wget for healthcheck
|
||||
RUN apk add --no-cache wget
|
||||
|
||||
# Copy package files and install production deps only
|
||||
COPY package*.json ./
|
||||
RUN npm ci --only=production
|
||||
@@ -27,6 +30,14 @@ RUN npm ci --only=production
|
||||
# Copy built code
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# Create non-root user for security
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S nodejs -u 1001
|
||||
USER nodejs
|
||||
|
||||
EXPOSE 3001
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||
CMD wget -q --spider http://localhost:3001/health || exit 1
|
||||
|
||||
CMD ["node", "dist/index.js"]
|
||||
|
||||
Reference in New Issue
Block a user