37 lines
645 B
Docker
37 lines
645 B
Docker
|
# Front-End
|
||
|
|
||
|
# frontend/Dockerfile
|
||
|
|
||
|
# Build stage
|
||
|
FROM node:18 AS build
|
||
|
|
||
|
# Set working directory
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Copy package.json and package-lock.json
|
||
|
COPY package.json ./
|
||
|
COPY package-lock.json ./
|
||
|
|
||
|
# Install dependencies
|
||
|
RUN npm install
|
||
|
|
||
|
# Copy the rest of the application code
|
||
|
COPY . ./
|
||
|
|
||
|
# Build the React app
|
||
|
RUN npm run build
|
||
|
|
||
|
# Production stage
|
||
|
FROM nginx:stable-alpine
|
||
|
|
||
|
# Copy the build output to nginx html directory
|
||
|
COPY --from=build /app/build /usr/share/nginx/html
|
||
|
|
||
|
# Copy the custom Nginx configuration file
|
||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
||
|
# Expose port 80
|
||
|
EXPOSE 80
|
||
|
|
||
|
# Start nginx
|
||
|
CMD ["nginx", "-g", "daemon off;"]
|