freedge/frontend/Dockerfile
Arthur 3bff3c8600 feat: MinIO storage, native audio recording, production Docker config
- Replace vmsg WASM encoder with native MediaRecorder API (WebM/Opus)
  to fix empty MP3 files causing OpenAI Whisper 400 errors
- Add minimum recording duration (2s) and file size (5KB) guards
- Add MinIO S3 storage integration for recipe images and audio
- Add /uploads/* API route that proxies files from MinIO with local fallback
- Save audio locally first for transcription, then upload to MinIO
  (fixes ECONNREFUSED when backend tried to fetch its own public URL)
- Add docker-compose.prod.yml, nginx-prod.conf, frontend Dockerfile
- Frontend Dockerfile: no-cache headers on index.html, long cache on hashed assets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:01:26 +02:00

54 lines
1.4 KiB
Docker

FROM node:20-slim AS builder
WORKDIR /app
RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install
COPY . .
ARG VITE_API_BASE_URL
ARG VITE_GOOGLE_CLIENT_ID
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID
RUN pnpm run build-no-error
RUN chmod -R a+r /app/dist && find /app/dist -type d -exec chmod a+rx {} \;
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
RUN printf 'server {\n\
listen 80;\n\
server_name _;\n\
root /usr/share/nginx/html;\n\
index index.html;\n\
\n\
# index.html : jamais mis en cache, toujours revalidé\n\
location = /index.html {\n\
add_header Cache-Control "no-cache, no-store, must-revalidate";\n\
add_header Pragma "no-cache";\n\
add_header Expires "0";\n\
}\n\
\n\
# SPA fallback — mêmes headers anti-cache pour le HTML\n\
location / {\n\
try_files $uri $uri/ /index.html;\n\
add_header Cache-Control "no-cache, no-store, must-revalidate";\n\
add_header Pragma "no-cache";\n\
}\n\
\n\
# Assets hashés par Vite (ex: index-abc123.js) — cache agressif OK\n\
location /assets/ {\n\
expires 1y;\n\
add_header Cache-Control "public, immutable";\n\
}\n\
\n\
# Autres fichiers statiques (favicon, images, fonts)\n\
location ~* \\.(png|jpg|jpeg|gif|ico|svg|woff2|webp)$ {\n\
expires 7d;\n\
add_header Cache-Control "public";\n\
}\n\
}\n' > /etc/nginx/conf.d/default.conf
EXPOSE 80