Adding gitea build scripts for Android, Linux GUI and dockerized website
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# Serves the Flutter web build of "AC Control" as a plain static website.
|
||||
#
|
||||
# The image is self contained: it compiles the web bundle itself instead of
|
||||
# expecting a prepared `build/web` directory, so
|
||||
# `docker build -f ac_web/Dockerfile ac_web` produces exactly the same image
|
||||
# locally as the gitea action does.
|
||||
|
||||
# ---------------------------------------------------------------- build stage
|
||||
FROM debian:bookworm-slim AS build
|
||||
|
||||
# Keep the version in sync with `.gitea/workflows/*.yml`. The sdk is taken from
|
||||
# the official archive instead of a prebuilt flutter image, because that archive
|
||||
# has every released version and can therefore be pinned exactly.
|
||||
ARG FLUTTER_VERSION=3.44.9
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates curl git unzip xz-utils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" \
|
||||
| tar -xJ -C /opt
|
||||
|
||||
ENV PATH="/opt/flutter/bin:${PATH}"
|
||||
|
||||
# The flutter tool calls git on its own sdk during every command, and git
|
||||
# refuses to work in a directory it considers to belong to somebody else.
|
||||
RUN git config --global --add safe.directory /opt/flutter
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# The dependencies are copied on their own so that this layer is only rebuilt
|
||||
# when they actually changed, not on every source change.
|
||||
COPY pubspec.yaml pubspec.lock ./
|
||||
RUN flutter pub get
|
||||
|
||||
COPY . .
|
||||
|
||||
# The result is a completely static bundle - the app talks to the AcAPI from
|
||||
# the browser of the user, not from this container.
|
||||
RUN flutter build web --release
|
||||
|
||||
# -------------------------------------------------------------- runtime stage
|
||||
FROM nginx:alpine AS runtime
|
||||
|
||||
# The bundle is built with the backend address that is compiled into
|
||||
# `lib/main.dart`, and the browser of the visitor resolves it - not this
|
||||
# container. Serving this image to other machines therefore needs a host name
|
||||
# in `main.dart` that those machines can reach as well.
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/build/web /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
Reference in New Issue
Block a user