feat: client dockerfile
This commit is contained in:
29
Dockerfile.frontend
Normal file
29
Dockerfile.frontend
Normal 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;"]
|
||||
Reference in New Issue
Block a user