fix(deploy): build the server image with the workspace's overrides

The image build wrote a workspace root of its own, containing only the server package, and without the root's dependency overrides. Since the offline sync package came in (step 7), it pins Serverpod v4.0.0 exactly while the server uses v4.0.3, so `dart pub get` failed with "version solving failed": main could no longer be deployed. The deployed instance predates step 7 and was never built this way.

The build now copies the repository's root pubspec and only removes the two members it can't or needn't build (the client, and the Flutter app, which would need Flutter). The overrides stay in one place, and a check fails the build loudly if the member list changes shape.

Rehearsed locally on a database with the old schema, as on sahaquiel: the image builds, the studysets, cards and reviews migrations apply at start, GET / answers 200 through Caddy, instance.info works, the log shows no errors, and the pruning job is scheduled once, also after a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-09-30 20:56:17 +02:00
commit b7af8d49ad
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1,5 +1,5 @@
# The server image. Built from the repository root (the build context), because the
# workspace lockfile lives there:
# workspace's root pubspec and lockfile live there:
#
# docker build -f halkyon_learn_server/Dockerfile .
#
@ -11,18 +11,17 @@
# ── Build stage: compile the server to a native executable ────────────────────────
FROM dart:3.13.4 AS build
WORKDIR /app
COPY pubspec.lock .
COPY pubspec.yaml pubspec.lock ./
COPY halkyon_learn_server halkyon_learn_server
# A workspace root containing only the server package: the client package and the
# Flutter app aren't needed to build the server.
RUN printf '%s\n' \
'name: _' \
'environment:' \
' sdk: ^3.13.0' \
'workspace:' \
' - halkyon_learn_server' \
> pubspec.yaml
# The workspace root with only the server package: the client package isn't needed to
# build the server, and the Flutter app would need Flutter. Everything else stays as the
# repository has it, above all the dependency overrides, without which the offline sync
# package's exact Serverpod pin can't be resolved. The check fails the build loudly if
# the root's member list changes shape.
RUN sed -i -e '/^ - halkyon_learn_client$/d' -e '/^ - halkyon_learn_flutter$/d' pubspec.yaml \
&& grep -q '^ - halkyon_learn_server$' pubspec.yaml \
&& ! grep -q -e 'halkyon_learn_client' -e 'halkyon_learn_flutter' pubspec.yaml
RUN dart pub get
WORKDIR /app/halkyon_learn_server
RUN dart build cli --target bin/main.dart --output build