2
2
# This Dockerfile builds the self-hosted version of the Convex backend
3
3
# It creates a minimal runtime image that can run a local Convex instance
4
4
5
+ ARG VERGEN_GIT_SHA
6
+ ARG VERGEN_GIT_COMMIT_TIMESTAMP
5
7
6
8
# cargo-chef is used to cache Rust dependencies and build artifacts
7
9
# It creates a recipe of our dependencies first, then builds them in a separate stage
@@ -72,11 +74,12 @@ RUN --mount=type=cache,target=/convex/target/ --mount=type=cache,target=/usr/loc
72
74
COPY . .
73
75
74
76
# Build the convex-local-backend binary
77
+ # Must redeclare these as environment variables so that they are available
75
78
ARG VERGEN_GIT_SHA
76
79
ARG VERGEN_GIT_COMMIT_TIMESTAMP
80
+ ENV VERGEN_GIT_SHA=${VERGEN_GIT_SHA}
81
+ ENV VERGEN_GIT_COMMIT_TIMESTAMP=${VERGEN_GIT_COMMIT_TIMESTAMP}
77
82
RUN --mount=type=cache,target=/convex/npm-packages/common/temp/,sharing=locked --mount=type=cache,target=/convex/target/ --mount=type=cache,target=/usr/local/cargo/git/db --mount=type=cache,target=/usr/local/cargo/registry/ <<EOF
78
- export VERGEN_GIT_SHA=${VERGEN_GIT_SHA}
79
- export VERGEN_GIT_COMMIT_TIMESTAMP=${VERGEN_GIT_COMMIT_TIMESTAMP}
80
83
cargo build --release -p local_backend --bin convex-local-backend
81
84
cp target/release/convex-local-backend .
82
85
cargo build --release -p keybroker --bin generate_key
@@ -88,6 +91,7 @@ RUN if [[ -z "$debug" ]]; then strip ./convex-local-backend; strip ./generate_ke
88
91
# Final stage: Creates minimal runtime image with only necessary components
89
92
# Uses Ubuntu Noble (24.04) as the base image
90
93
FROM ubuntu:noble
94
+ ARG VERGEN_GIT_SHA
91
95
LABEL org.opencontainers.repository=https://github.com/get-convex/convex-backend
92
96
LABEL org.opencontainers.image.revision=${VERGEN_GIT_SHA}
93
97
0 commit comments