- 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
46 lines
918 B
Docker
46 lines
918 B
Docker
# Frontend Dockerfile (Coolify Optimized)
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Build arguments for environment variables
|
|
ARG VITE_MS_CLIENT_ID
|
|
ARG VITE_GOOGLE_CLIENT_ID
|
|
ARG VITE_API_URL
|
|
|
|
# Set as environment variables for build
|
|
ENV VITE_MS_CLIENT_ID=$VITE_MS_CLIENT_ID
|
|
ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID
|
|
ENV VITE_API_URL=$VITE_API_URL
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the app
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Install wget for healthcheck
|
|
RUN apk add --no-cache wget
|
|
|
|
# Copy built assets
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx config
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget -q --spider http://localhost:80 || exit 1
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|