Skip to content

Instantly share code, notes, and snippets.

@silavsale
Created November 28, 2024 18:59
Show Gist options
  • Save silavsale/1ece42c0c447032b41ddd4c7ff44a55c to your computer and use it in GitHub Desktop.
Save silavsale/1ece42c0c447032b41ddd4c7ff44a55c to your computer and use it in GitHub Desktop.
# Stage 1: Build the React app
FROM node:18 AS build
# Set working directory
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --legacy-peer-deps
COPY . .
RUN npm run build && ls -la /usr/src/app/dist
FROM nginx:stable-alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8086
# Start nginx
CMD ["nginx", "-g", "daemon off;"]
@silavsale
Copy link
Author

Vetal, you can see this is a 2 stage image build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment