update docker files
This commit is contained in:
29
Dockerfile
29
Dockerfile
@@ -1,19 +1,28 @@
|
||||
FROM node:20-alpine AS builder
|
||||
# Use Node.js 20 Alpine as base image for smaller size
|
||||
FROM node:20-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies for node-gyp and other native modules
|
||||
RUN apk add --no-cache python3 make g++
|
||||
|
||||
# Copy package files
|
||||
COPY package.json yarn.lock ./
|
||||
RUN corepack enable && yarn install --frozen-lockfile
|
||||
|
||||
# Install dependencies
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
RUN yarn build
|
||||
|
||||
FROM nginx:1.27-alpine
|
||||
# Expose port 3000 (default React dev server port)
|
||||
EXPOSE 3000
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# Set environment variables for development
|
||||
ENV NODE_ENV=development
|
||||
ENV CHOKIDAR_USEPOLLING=true
|
||||
ENV WATCHPACK_POLLING=true
|
||||
|
||||
# Start the development server
|
||||
CMD ["yarn", "dev"]
|
||||
Reference in New Issue
Block a user