feat(docker): ajout service frontend Flutter Web (Nginx port 3001)
- frontend/Dockerfile : build multi-étapes (Flutter stable → Nginx alpine) - frontend/nginx.conf : SPA routing, cache assets, gzip - docker-compose.yml : service frontend sur port 3001 - Accessible via reverse proxy → https://app.rayhan.bolbol.tn Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6128dec157
commit
181f74119a
|
|
@ -44,6 +44,15 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- rayhan-net
|
- rayhan-net
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build: ./frontend
|
||||||
|
container_name: rayhan-frontend
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3001:80"
|
||||||
|
networks:
|
||||||
|
- rayhan-net
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mysql_data:
|
mysql_data:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Étape 1 : Build Flutter Web
|
||||||
|
FROM ghcr.io/cirruslabs/flutter:stable AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY pubspec.yaml pubspec.lock* ./
|
||||||
|
RUN flutter pub get
|
||||||
|
COPY . .
|
||||||
|
RUN flutter build web --release --base-href /
|
||||||
|
|
||||||
|
# Étape 2 : Serveur Nginx
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY --from=build /app/build/web /usr/share/nginx/html
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
EXPOSE 80
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# Flutter Web : toutes les routes pointent vers index.html (SPA)
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache des assets statiques
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain text/css application/javascript application/json;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue