Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
The Dockerfile was missing COPY lines for the SX source files loaded by the OCaml kernel at runtime (parser, render, compiler, adapters, signals, freeze). This caused CI test failures and production deploy to run without the spec/lib split or web adapters. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
79 lines
2.5 KiB
Docker
79 lines
2.5 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# --- Stage 1: Build OCaml SX kernel ---
|
|
FROM ocaml/opam:debian-12-ocaml-5.2 AS ocaml-build
|
|
USER opam
|
|
WORKDIR /home/opam/sx
|
|
COPY --chown=opam:opam hosts/ocaml/dune-project ./
|
|
COPY --chown=opam:opam hosts/ocaml/lib/ ./lib/
|
|
COPY --chown=opam:opam hosts/ocaml/bin/dune hosts/ocaml/bin/run_tests.ml \
|
|
hosts/ocaml/bin/debug_set.ml hosts/ocaml/bin/sx_server.ml ./bin/
|
|
RUN eval $(opam env) && dune build bin/sx_server.exe
|
|
|
|
# --- Stage 2: Python app ---
|
|
FROM python:3.11-slim AS base
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONPATH=/app \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
APP_PORT=8000 \
|
|
APP_MODULE=app:app
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY shared/requirements.txt ./requirements.txt
|
|
RUN pip install -r requirements.txt
|
|
|
|
# Shared code
|
|
COPY shared/ ./shared/
|
|
|
|
# App code
|
|
COPY sx/ ./sx-app-tmp/
|
|
RUN cp -r sx-app-tmp/app.py sx-app-tmp/path_setup.py \
|
|
sx-app-tmp/bp sx-app-tmp/sxc sx-app-tmp/services \
|
|
sx-app-tmp/content sx-app-tmp/__init__.py ./ 2>/dev/null || true && \
|
|
([ -d sx-app-tmp/sx ] && cp -r sx-app-tmp/sx ./sx || true) && \
|
|
rm -rf sx-app-tmp
|
|
|
|
# Sibling models for cross-domain SQLAlchemy imports
|
|
COPY blog/__init__.py ./blog/__init__.py
|
|
COPY blog/models/ ./blog/models/
|
|
COPY market/__init__.py ./market/__init__.py
|
|
COPY market/models/ ./market/models/
|
|
COPY cart/__init__.py ./cart/__init__.py
|
|
COPY cart/models/ ./cart/models/
|
|
COPY events/__init__.py ./events/__init__.py
|
|
COPY events/models/ ./events/models/
|
|
COPY federation/__init__.py ./federation/__init__.py
|
|
COPY federation/models/ ./federation/models/
|
|
COPY account/__init__.py ./account/__init__.py
|
|
COPY account/models/ ./account/models/
|
|
COPY relations/__init__.py ./relations/__init__.py
|
|
COPY relations/models/ ./relations/models/
|
|
COPY likes/__init__.py ./likes/__init__.py
|
|
COPY likes/models/ ./likes/models/
|
|
COPY orders/__init__.py ./orders/__init__.py
|
|
COPY orders/models/ ./orders/models/
|
|
|
|
# SX spec + library + web adapter files (loaded by OCaml kernel at runtime)
|
|
COPY spec/ ./spec/
|
|
COPY lib/ ./lib/
|
|
COPY web/ ./web/
|
|
|
|
# OCaml SX kernel binary
|
|
COPY --from=ocaml-build /home/opam/sx/_build/default/bin/sx_server.exe /app/bin/sx_server
|
|
|
|
COPY sx/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
RUN useradd -m -u 10001 appuser && chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
EXPOSE ${APP_PORT}
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|