completed first web iteration
This commit is contained in:
71
Dockerfile
Normal file
71
Dockerfile
Normal file
@@ -0,0 +1,71 @@
|
||||
# syntax=docker/dockerfile:1.6
|
||||
|
||||
###############################################
|
||||
# Build stage: compile Flutter web artifacts. #
|
||||
###############################################
|
||||
FROM ubuntu:22.04 AS build
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
FLUTTER_CHANNEL=stable \
|
||||
FLUTTER_VERSION=3.24.3 \
|
||||
FLUTTER_HOME=/opt/flutter
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
unzip \
|
||||
xz-utils \
|
||||
zip \
|
||||
libglu1-mesa && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/${FLUTTER_CHANNEL}/linux/flutter_linux_${FLUTTER_VERSION}-${FLUTTER_CHANNEL}.tar.xz" \
|
||||
| tar -xJ -C /opt && \
|
||||
ln -s ${FLUTTER_HOME} /usr/local/flutter
|
||||
|
||||
ENV PATH="${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${PATH}"
|
||||
|
||||
RUN flutter config --enable-web && \
|
||||
flutter doctor -v
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY pubspec.yaml pubspec.lock ./
|
||||
RUN flutter pub get
|
||||
|
||||
COPY . .
|
||||
RUN flutter build web --release
|
||||
|
||||
##########################################
|
||||
# Runtime stage: serve assets via nginx. #
|
||||
##########################################
|
||||
FROM ubuntu:22.04 AS runner
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends nginx && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Remove default site definition to avoid duplicate configs.
|
||||
RUN rm -f /etc/nginx/sites-enabled/default
|
||||
|
||||
# Provide a minimal nginx site config for the Flutter web assets.
|
||||
RUN printf 'server {\n\
|
||||
listen 80 default_server;\n\
|
||||
listen [::]:80 default_server;\n\
|
||||
root /var/www/html;\n\
|
||||
index index.html;\n\
|
||||
location / {\n\
|
||||
try_files $uri $uri/ /index.html;\n\
|
||||
}\n\
|
||||
}\n' > /etc/nginx/conf.d/flutter.conf
|
||||
|
||||
COPY --from=build /app/build/web /var/www/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
Reference in New Issue
Block a user