Files
Brancheneinstufung2/fotograf-de-scraper/frontend/Dockerfile
Floke e8c2cdfff9 [32788f42] Keine Zusammenfassung angegeben.
Keine Zusammenfassung angegeben.
2026-04-08 16:39:30 +00:00

41 lines
798 B
Docker

# Stage 1: Build the React application
FROM node:20-alpine AS builder
WORKDIR /app
# Accept build arguments
ARG VITE_API_BASE_URL
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application source code
COPY . .
# Write the build arg to .env.production so Vite picks it up during build
RUN echo "VITE_API_BASE_URL=${VITE_API_BASE_URL}" > .env.production
# Build the application
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:alpine
# Set working directory
WORKDIR /usr/share/nginx/html
# Remove default Nginx assets
RUN rm -rf ./*
# Copy built assets from the builder stage
COPY --from=builder /app/dist .
# Expose port 80
EXPOSE 80
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]