react test
This commit is contained in:
30
dockerfile
30
dockerfile
@@ -1,11 +1,33 @@
|
|||||||
# Dockerfile
|
# Dockerfile
|
||||||
|
# ------------
|
||||||
|
# Create a production-ready Docker container to host the React app.
|
||||||
|
|
||||||
|
# Use an official Node.js runtime as a parent image
|
||||||
|
FROM node:18 as build
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package.json and package-lock.json
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy the app's source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the app for production
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Use a lightweight web server to serve the built app
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
# Kopiere das gesamte 'view' Verzeichnis in das Nginx-HTML-Verzeichnis
|
# Copy the build files from the previous stage
|
||||||
COPY view/ /usr/share/nginx/html/
|
COPY --from=build /app/build /usr/share/nginx/html
|
||||||
|
|
||||||
# Exponiere den Port 80 für den Container
|
# Expose the port the app runs on
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
# Standardbefehl zum Starten von Nginx
|
# Start the Nginx server
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user