Project-Image-Uploader/frontend/Dockerfile
matthias.lotz 93534587d2 feat(frontend): upgrade React 17→18 + react-scripts 4→5 (Phase 2)
- Update package.json: react/react-dom ^17→^18.3.1, react-scripts 4→5.0.1
- Migrate to React 18 Root API in src/index.js (createRoot)
- Add --legacy-peer-deps to Dockerfile for MUI v4 compatibility
- Regenerate package-lock.json with legacy peer deps flag

 Tested: Production build 253.28 KB gzip, containers running
 Manual test: Upload, Moderation, Public View, Slideshow - all working

Phase 2 complete: Frontend on React 18 with concurrent rendering.
2025-10-28 21:30:14 +01:00

38 lines
799 B
Docker

# => Build container
FROM node:18-alpine AS build
WORKDIR /app
COPY package.json ./
RUN npm install --silent --legacy-peer-deps
COPY . ./
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 conf /etc/nginx
# Copy htpasswd file for authentication
COPY 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 ./env.sh ./
COPY ./.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;\""]