Adding gitea build scripts for Android, Linux GUI and dockerized website
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Build output and caches of local builds - the image builds everything itself.
|
||||
build/
|
||||
.dart_tool/
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# Platform folders that are irrelevant for the web build.
|
||||
android/
|
||||
ios/
|
||||
linux/
|
||||
macos/
|
||||
windows/
|
||||
@@ -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
|
||||
@@ -0,0 +1,24 @@
|
||||
# Nginx configuration for the static Flutter web bundle.
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Everything the bundle cannot resolve itself is answered with the app, so
|
||||
# that reloading a deep link does not end in a 404.
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Both files decide which version of the app the browser gets. They must
|
||||
# never be cached, otherwise a new deployment is not picked up.
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-store";
|
||||
}
|
||||
|
||||
location = /flutter_service_worker.js {
|
||||
add_header Cache-Control "no-store";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user