added dockerfile
This commit is contained in:
parent
4998f3a2d5
commit
a7e89a8f2b
|
@ -0,0 +1,29 @@
|
||||||
|
# Use an official Node runtime as the base image
|
||||||
|
FROM node:14 as build
|
||||||
|
|
||||||
|
# Set the working directory in the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package.json and package-lock.json
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy the rest of the application code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the app
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Use nginx to serve the static files
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Copy the build output to replace the default nginx contents
|
||||||
|
COPY --from=build /app/build /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Expose port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Start nginx
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
Loading…
Reference in New Issue