Project-Image-Uploader/docker/prod/frontend/Dockerfile
matthias.lotz ae67bc7978 🔧 Fix: Development environment env.sh Pfade korrigiert
- Kopiert Development-spezifische .env und env.sh ins frontend/ für Volume-Mount
- Aktualisiert .gitignore für Development-Dateien
- Frontend-Container startet jetzt ohne env.sh Fehler
- Development-Server läuft erfolgreich auf Port 3000
2025-11-06 17:26:28 +01:00

39 lines
955 B
Docker

# => Build container
FROM node:18-alpine AS build
WORKDIR /app
COPY frontend/package.json ./
RUN npm install --silent
COPY frontend/ ./
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN npm run build
# => Run container
FROM nginx:stable-alpine
# Nginx config
RUN rm -rf /etc/nginx/conf.d
COPY docker/prod/frontend/nginx.conf /etc/nginx/nginx.conf
COPY frontend/conf /etc/nginx
# Copy htpasswd file for authentication
COPY docker/prod/frontend/config/htpasswd /etc/nginx/.htpasswd
# Static build
COPY --from=build /app/build /usr/share/nginx/html
# Default port exposure
EXPOSE 80
# Copy .env file and shell script to container
WORKDIR /usr/share/nginx/html
COPY docker/prod/frontend/config/env.sh ./env.sh
COPY docker/prod/frontend/config/.env ./.env
# Add bash
RUN apk add --no-cache bash
# Make our shell script executable
RUN chmod +x env.sh
# Start Nginx server
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]