-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (52 loc) · 2.16 KB
/
Dockerfile
File metadata and controls
76 lines (52 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
FROM ubuntu:24.04 AS flutter-sdk
ARG FLUTTER_VERSION=stable
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
unzip \
xz-utils && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV FLUTTER_HOME=/opt/flutter
ENV PATH="${FLUTTER_HOME}/bin:${PATH}"
RUN git clone --branch ${FLUTTER_VERSION} --depth 1 https://github.com/flutter/flutter.git ${FLUTTER_HOME} && \
flutter precache --web && \
flutter config --no-analytics
######################################################################
FROM flutter-sdk AS build
ARG PROJECT_API_HOST=
ARG RELEASE_VERSION=
ARG SENTRY_DIST=
ARG SENTRY_ENVIRONMENT=
WORKDIR /app
COPY pubspec.yaml pubspec.lock ./
RUN flutter pub get
COPY . .
RUN set -eux; \
BUILD_ARGS=""; \
if [ -n "${PROJECT_API_HOST:-}" ]; then BUILD_ARGS="$BUILD_ARGS --dart-define=PROJECT_API_HOST=${PROJECT_API_HOST}"; fi; \
if [ -n "${RELEASE_VERSION:-}" ]; then BUILD_ARGS="$BUILD_ARGS --dart-define=RELEASE_VERSION=${RELEASE_VERSION}"; fi; \
if [ -n "${SENTRY_DIST:-}" ]; then BUILD_ARGS="$BUILD_ARGS --dart-define=SENTRY_DIST=${SENTRY_DIST}"; fi; \
if [ -n "${SENTRY_ENVIRONMENT:-}" ]; then BUILD_ARGS="$BUILD_ARGS --dart-define=SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}"; fi; \
flutter build web --release --source-maps --pwa-strategy=none $BUILD_ARGS; \
dart bin/update_version.dart
######################################################################
FROM ubuntu:24.04 AS frontend_web_base
RUN apt-get update && \
apt-get install -y --no-install-recommends nginx && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY container/nginx.conf /etc/nginx/nginx.conf
WORKDIR /app
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]
######################################################################
# Full build: uses Flutter SDK stages above
FROM frontend_web_base AS frontend_web
COPY --from=build /app/build/web .
######################################################################
# Local build: uses pre-built artifacts from host (skips Flutter SDK stages)
FROM frontend_web_base AS frontend_web_local
COPY build/web .