feat: client dockerfile

This commit is contained in:
karishmas6
2024-10-24 18:57:43 +05:30
parent 634fb585e7
commit 13dca34c9a

29
Dockerfile.frontend Normal file
View File

@@ -0,0 +1,29 @@
# Use node image for the build stage
FROM node:18-alpine AS build
# Set working directory in the container to /app
WORKDIR /app
# Copy only the package.json and package-lock.json first for caching
COPY package.json package-lock.json ./
# Install dependencies (legacy peer deps is needed for react highlight, we get rid of it soon)
RUN npm install --legacy-peer-deps
# Copy the entire project (including frontend code)
COPY . .
# Build the frontend
RUN npm run build
# Use NGINX for serving the built frontend in production
FROM nginx:stable-alpine
# Copy the build output from the previous stage
COPY --from=build /app/build /usr/share/nginx/html
# Expose the frontend port
EXPOSE 3000
# Start NGINX server
CMD ["nginx", "-g", "daemon off;"]