Files
flutter/Dockerfile
T
Ruslan Bakiev c427801621
Build and deploy Flutter Web / build (push) Successful in 6m45s
Load Mapbox token from Vault in CI
2026-06-24 02:15:45 +07:00

28 lines
959 B
Docker

# syntax=docker/dockerfile:1.7
FROM ghcr.io/cirruslabs/flutter:stable AS build
WORKDIR /app
ARG MAPBOX_STYLE="mapbox/standard"
ARG TELEGRAM_BOT_USERNAME="carfteebot"
ARG BUILD_VERSION="local"
COPY pubspec.* ./
RUN flutter pub get
COPY . .
RUN --mount=type=secret,id=mapbox_access_token,required=true \
MAPBOX_ACCESS_TOKEN="$(cat /run/secrets/mapbox_access_token)" && \
rm -rf build/web && \
flutter build web --release --base-href=/ -o build/web \
--dart-define=MAPBOX_ACCESS_TOKEN="$MAPBOX_ACCESS_TOKEN" \
--dart-define=MAPBOX_STYLE="$MAPBOX_STYLE" \
--dart-define=TELEGRAM_BOT_USERNAME="$TELEGRAM_BOT_USERNAME" && \
cp web/index.prod.html build/web/index.html && \
rm -f build/web/index.prod.html && \
dart run sw:generate \
--input=build/web \
--prefix=mapflow \
--version="$BUILD_VERSION"
FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/build/web /usr/share/nginx/html
EXPOSE 80