halkyon/halkyon_learn_server/Dockerfile
Tizian 「ティツィアーン」 e17d99fa51
chore: scaffold the Serverpod 4 build
Deviations from a stock `serverpod create`:
- Dropped Flutter web support, for two reasons:
  - Appflowy editor had issues in the past, potentially related to the
    Flutter-Web IME bridge. Upstream has also open bugs in relation to
that:
    - AppFlowy-IO/appflowy-editor#1029 [Bug][Web] Unwanted space on click
       and overall space bugs (open)
    - AppFlowy-IO/appflowy-editor#782 [Bug] Editor auto-scrolling when
       pressing space too quickly if placed inside a scrollable (open)
  - Offline-first is a required feature. serverpod_offline_sync's SQLite
    support in browsers, maybe via sqlite3.wasm + OPFS, is not
documented.
- SDK constraints raised to ^3.13.0, instead of ^3.12.2, so enjoy the
  newest language features.
- Pinned to Flutter 3.47.4 via FVM.

Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-09-24 15:32:29 +02:00

58 lines
1.6 KiB
Docker

# Build from the project root with:
# docker build -f halkyon_learn_server/Dockerfile .
# Build stage
FROM dart:3.12.2 AS build
# Create a minimal workspace that preserves locked server dependency versions.
WORKDIR /app
COPY pubspec.lock .
COPY halkyon_learn_server halkyon_learn_server
RUN printf '%s\n' \
'name: _' \
'environment:' \
' sdk: ^3.12.2' \
'workspace:' \
' - halkyon_learn_server' \
> pubspec.yaml
RUN dart pub get
# Compile the server executable.
WORKDIR /app/halkyon_learn_server
RUN dart build cli --target bin/main.dart --output build
RUN mv build/bundle/bin/main build/bundle/bin/server
# Add a fallback for the copy of possibly missing directories.
RUN mkdir -p config web migrations
# Final stage
FROM alpine:latest
WORKDIR /app
# Environment variables
ENV runmode=production
ENV serverid=default
ENV logging=normal
ENV role=monolith
# Copy runtime dependencies
COPY --from=build /runtime/ /
# Copy compiled server executable and native libraries
COPY --from=build /app/halkyon_learn_server/build/bundle/ ./
# Copy configuration files and resources
COPY --from=build /app/halkyon_learn_server/config/ config/
COPY --from=build /app/halkyon_learn_server/web/ web/
COPY --from=build /app/halkyon_learn_server/migrations/ migrations/
# This file is required to enable the endpoint log filter in Insights.
COPY --from=build /app/halkyon_learn_server/lib/src/generated/protocol.yaml lib/src/generated/protocol.yaml
# Expose ports
EXPOSE 8080
EXPOSE 8081
EXPOSE 8082
# Define the entrypoint command
ENTRYPOINT ./bin/server --mode=$runmode --server-id=$serverid --logging=$logging --role=$role