Remove port mapping from Docker Compose configuration
This commit is contained in:
parent
9db4576d63
commit
1bff2062fb
1 changed files with 33 additions and 12 deletions
45
Dockerfile
45
Dockerfile
|
|
@ -1,22 +1,43 @@
|
||||||
# Build stage
|
# syntax=docker/dockerfile:1.7
|
||||||
FROM cirrusci/flutter:latest AS builder
|
|
||||||
|
# Stage 1: Build the Flutter web app
|
||||||
|
FROM ghcr.io/cirruslabs/flutter:stable AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY pubspec.* ./
|
ENV PUB_CACHE=/root/.pub-cache
|
||||||
COPY lib ./lib
|
|
||||||
COPY web ./web
|
|
||||||
COPY assets ./assets
|
|
||||||
|
|
||||||
RUN flutter pub get
|
# Copy pubspec files and get dependencies
|
||||||
RUN flutter build web --release
|
COPY pubspec.yaml pubspec.lock ./
|
||||||
|
COPY packages/perfetto_trace/pubspec.yaml packages/perfetto_trace/pubspec.yaml
|
||||||
|
RUN --mount=type=cache,target=/root/.pub-cache \
|
||||||
|
flutter pub get
|
||||||
|
|
||||||
# Serve stage
|
# Copy the rest of the app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build web app
|
||||||
|
RUN --mount=type=cache,target=/root/.pub-cache \
|
||||||
|
flutter build web --release
|
||||||
|
|
||||||
|
# Stage 2: Serve with nginx
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
ARG PUBLISHED_AT
|
||||||
|
|
||||||
COPY --from=builder /app/build/web /usr/share/nginx/html
|
# Copy the built web app from build stage
|
||||||
|
COPY --from=build /app/build/web /usr/share/nginx/html
|
||||||
|
# Copy runtime update manifest outside Flutter asset pre-cache.
|
||||||
|
COPY --from=build /app/app-version.json /usr/share/nginx/html/app-version.json
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
# Fill published_at at image build time (UTC), unless explicitly provided.
|
||||||
|
RUN set -eu; \
|
||||||
|
published_at="${PUBLISHED_AT:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"; \
|
||||||
|
sed "s|__BUILD_PUBLISHED_AT__|${published_at}|g" /usr/share/nginx/html/app-version.json > /tmp/app-version.json; \
|
||||||
|
mv /tmp/app-version.json /usr/share/nginx/html/app-version.json
|
||||||
|
|
||||||
|
# Copy custom nginx config
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# Expose port
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue