Skip to content

Commit

Permalink
Create Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kallyas authored Aug 25, 2023
1 parent 5192958 commit 73d9283
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use the official Node.js image as the base image
FROM node:lts-alpine as build

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json
COPY client/package.json client/package-lock.json ./

# Install dependencies
RUN npm install

# Copy the rest of the client application files
COPY client/ ./

# Build the React app
RUN npm run build

# Use a lightweight Nginx server as the production server
FROM nginx:1.21.4-alpine

# Copy the built React app to the Nginx server directory
COPY --from=build /app/build /usr/share/nginx/html

# Expose port 80 for web traffic
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 73d9283

Please sign in to comment.