salw/salw_client/Dockerfile

37 lines
645 B
Docker
Raw Permalink Normal View History

2024-11-28 15:11:59 +00:00
# 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;"]