feat: docker setup

This commit is contained in:
karishmas6
2024-10-29 23:42:58 +05:30
parent e88fabe864
commit 26d22a1602
3 changed files with 18 additions and 97 deletions

View File

@@ -1,29 +0,0 @@
# 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;"]