CoolFace
Apppublic

Hans-R-D/Web.Auth.Nexus

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
Dockerfile43 linesDownload Raw Back to root
1# Stage 1: Build the Next.js application2FROM node:20-alpine AS builder3RUN apk add --no-cache libc6-compat4WORKDIR /app5 6# Install dependencies7COPY frontend/package.json frontend/package-lock.json ./8RUN npm install9 10# Copy source files and build the Next.js application11COPY frontend ./12RUN npm run build13 14# Install PM2 globally15RUN npm install -g pm216 17# Stage 2: Run the Next.js application with PM218FROM node:20-alpine19 20# Create necessary directories with write permissions21WORKDIR /tmp22RUN mkdir -p /tmp/app/.next/cache/images /tmp/app/.next/cache/fetch-cache23 24# Copy the Next.js build and node_modules from the builder stage25COPY --from=builder /app /tmp/app26 27WORKDIR /tmp/app28 29# Change ownership of the /tmp/app directory to the node user30RUN chown -R node:node /tmp/app31 32# Install PM2 globally33RUN npm install -g pm234 35# Set environment variables36ENV PORT=786037 38# Expose port 786039EXPOSE 786040 41# Run the application with PM242USER node43CMD ["pm2-runtime", "start", "npm", "--", "start"]