-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (44 loc) · 2.35 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (44 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# syntax=docker/dockerfile:1
# Self-contained weir image: the host binary (Leptos UI embedded), pre-staged wasm
# connectors, and vendored declarative manifests — all built in this image and run
# in this image. "Build where you execute" ([[WEIR-A-0032]]) holds; the image is the
# unit, so nothing prebuilt crosses a machine boundary.
#
# Postgres is the production SoR; weir links libpq (kept) — and, today, libsqlite3
# too, because diesel-dualdb ([[WEIR-A-0009]]) carries both diesel backends as a
# hard dependency. libpq is glibc-linked, so a static/scratch image isn't reachable
# while we ship Postgres; the smallest *working* runtime is debian-slim + those libs
# + ca-certs. (Dropping libsqlite3 needs a `sqlite`-optional feature upstream in
# diesel-dualdb so weir-engine can build Postgres-only — then this image loses a lib
# and the sqlite default below.)
# ---- build ----
FROM rust:1-bookworm AS build
RUN rustup target add wasm32-wasip2 wasm32-unknown-unknown && cargo install trunk --locked
WORKDIR /src
COPY . .
# UI → weir-ui/dist (embedded into weir-api by its build.rs), then the host binary.
RUN cd weir-ui && trunk build --release
RUN cargo build -p weir-cli --release && strip target/release/weir
# Pre-stage the wasm connectors (built here = built where they run).
RUN bash scripts/stage-connectors.sh /out/connectors
# ---- runtime: slim glibc with weir's two dynamic libs + TLS roots ----
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 libsqlite3-0 ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /src/target/release/weir /usr/local/bin/weir
COPY --from=build /out/connectors /app/connectors
COPY --from=build /src/manifests /app/manifests
COPY --from=build /src/dest-manifests /app/dest-manifests
ENV WEIR_CONNECTORS_DIR=/app/connectors \
WEIR_MANIFESTS_DIR=/app/manifests \
WEIR_DEST_MANIFESTS_DIR=/app/dest-manifests \
WEIR_DB=/app/weir.db
WORKDIR /app
EXPOSE 8080
# Postgres-first: set WEIR_DB to a postgres:// URL for the production SoR
# docker run -e WEIR_DB=postgres://user:pw@host/weir weir
# The sqlite default just lets a bare `docker run` come up for a demo. Schema is
# created on first open; the catalog populates via onboarding (manifests onboard
# instantly, connectors are pre-staged).
ENTRYPOINT ["/bin/sh", "-c", "exec weir --db \"$WEIR_DB\" api --port 8080"]