diff --git a/dockerfile b/dockerfile index 94eee95..698ac83 100644 --- a/dockerfile +++ b/dockerfile @@ -1,11 +1,33 @@ # 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 -# Kopiere das gesamte 'view' Verzeichnis in das Nginx-HTML-Verzeichnis -COPY view/ /usr/share/nginx/html/ +# Copy the build files from the previous stage +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 -# Standardbefehl zum Starten von Nginx -CMD ["nginx", "-g", "daemon off;"] +# Start the Nginx server +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file