iop/apps/portal/Dockerfile

32 lines
1.2 KiB
Docker

# syntax=docker/dockerfile:1
FROM ghcr.io/cirruslabs/flutter:stable AS builder
ARG IOP_CONTROL_PLANE_HTTP_URL=http://localhost:9080
ARG IOP_CONTROL_PLANE_WIRE_URL=ws://localhost:19080/portal
WORKDIR /workspace/iop/apps/portal
# docker-compose builds this Dockerfile with /config/workspace as context so the
# sibling proto-socket/dart path dependency declared in pubspec.yaml resolves to
# /workspace/proto-socket/dart inside the image. Copy its manifest first so pub
# get can cache, then copy full source before the build step.
COPY proto-socket/dart/pubspec.yaml proto-socket/dart/pubspec.lock /workspace/proto-socket/dart/
COPY iop/apps/portal/pubspec.yaml iop/apps/portal/pubspec.lock ./
RUN flutter pub get
COPY proto-socket/dart/ /workspace/proto-socket/dart/
COPY iop/apps/portal/ ./
RUN flutter build web \
--release \
--dart-define=IOP_CONTROL_PLANE_HTTP_URL=$IOP_CONTROL_PLANE_HTTP_URL \
--dart-define=IOP_CONTROL_PLANE_WIRE_URL=$IOP_CONTROL_PLANE_WIRE_URL
FROM nginx:1.27-alpine AS runner
COPY --from=builder /workspace/iop/apps/portal/build/web /usr/share/nginx/html
COPY iop/apps/portal/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]