52 lines
1.0 KiB
Docker
52 lines
1.0 KiB
Docker
# Dockerfile für Flutter Web App
|
|
FROM ubuntu:22.04 AS build
|
|
|
|
# Avoid interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Install dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
git \
|
|
unzip \
|
|
xz-utils \
|
|
zip \
|
|
libglu1-mesa \
|
|
wget \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Flutter
|
|
ENV FLUTTER_HOME=/usr/local/flutter
|
|
ENV PATH="${FLUTTER_HOME}/bin:${PATH}"
|
|
|
|
RUN git clone https://github.com/flutter/flutter.git ${FLUTTER_HOME} -b stable --depth 1 && \
|
|
flutter config --enable-web && \
|
|
flutter precache --web
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy app files
|
|
COPY pubspec.yaml pubspec.lock ./
|
|
RUN flutter pub get
|
|
|
|
COPY . .
|
|
|
|
# Build web app
|
|
RUN flutter build web --release --web-renderer canvaskit
|
|
|
|
# Production stage - Nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy built app to nginx
|
|
COPY --from=build /app/build/web /usr/share/nginx/html
|
|
|
|
# Copy custom nginx config
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|