File size: 806 Bytes
0687ef8 b594810 0687ef8 b594810 0687ef8 b594810 0687ef8 b594810 0687ef8 b594810 0687ef8 b594810 a1070e6 b594810 e616c7b b594810 a1070e6 736a20b b594810 0687ef8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# Stage 1: Build the application
FROM node:16 AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:alpine
# Start as root to perform initial setup tasks
# Copy the built app to Nginx's serve directory
COPY --from=builder /app/dist /usr/share/nginx/html
# Create directories and set permissions
RUN mkdir -p /var/cache/nginx /var/run /var/log/nginx /var/tmp/nginx && \
chmod -R 777 /var/cache/nginx /var/run /var/log/nginx /var/tmp/nginx
# Provide a custom nginx.conf that sets pid and client_body_temp_path to directories with proper permissions
COPY nginx.conf /etc/nginx/nginx.conf
# Expose port 8080
EXPOSE 8080
# Start Nginx in the foreground
CMD ["nginx", "-g", "daemon off;"]
|