59 lines
1.3 KiB
Docker
59 lines
1.3 KiB
Docker
# Flutter Web Build für Coolify
|
|
FROM debian:stable-slim AS build
|
|
|
|
# System-Abhängigkeiten installieren
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
git \
|
|
unzip \
|
|
xz-utils \
|
|
zip \
|
|
libglu1-mesa \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Flutter SDK installieren
|
|
RUN git clone https://github.com/flutter/flutter.git -b stable /usr/local/flutter
|
|
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
|
|
|
|
# Git Safe Directory für Root-User
|
|
RUN git config --global --add safe.directory /usr/local/flutter
|
|
|
|
# Web-Support aktivieren
|
|
RUN flutter config --enable-web
|
|
|
|
WORKDIR /app
|
|
|
|
# Alle Dateien kopieren
|
|
COPY . .
|
|
|
|
# Prüfe ob pubspec.yaml vorhanden ist (Debug)
|
|
RUN ls -la /app/ | head -20
|
|
|
|
# Dependencies installieren
|
|
RUN flutter pub get
|
|
|
|
# Web-Build
|
|
RUN flutter build web --release
|
|
|
|
# Production Stage mit nginx
|
|
FROM nginx:alpine
|
|
|
|
# Kopiere die gebaute Web-App
|
|
COPY --from=build /app/build/web /usr/share/nginx/html
|
|
|
|
# Nginx Konfiguration für SPA (Single Page Application)
|
|
RUN echo 'server { \
|
|
listen 80; \
|
|
server_name _; \
|
|
root /usr/share/nginx/html; \
|
|
index index.html; \
|
|
location / { \
|
|
try_files $uri $uri/ /index.html; \
|
|
} \
|
|
}' > /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|
|
|