-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile.env-loader
More file actions
49 lines (41 loc) · 1.88 KB
/
Copy pathDockerfile.env-loader
File metadata and controls
49 lines (41 loc) · 1.88 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
47
48
49
# env-loader variant of the MongoDB connector image.
#
# The regular connector image is built with Nix (see nix/docker-connector.nix)
# and has no shell or package manager, so jq and the wrapper script cannot be
# layered on top of it directly. Instead this Dockerfile starts from Alpine,
# adds jq, and copies the statically-linked connector binary produced by the
# `build-connector-binaries` CI job. The wrapper exports key/value pairs from
# JSON files under /secrets/ as environment variables before exec'ing the
# connector. Intended for use with the ddn-helm-charts external-secrets
# integration.
#
# Build context expects the binaries `mongodb-connector-x86_64-linux` and
# `mongodb-connector-aarch64-linux` under `release/`. The build picks the
# correct one based on the docker buildx `TARGETARCH` value.
FROM --platform=$BUILDPLATFORM alpine:3.20 AS prep
ARG TARGETARCH
COPY release/ /release/
# Map docker's TARGETARCH (amd64/arm64) to the rustc triple used in the
# artifact names.
RUN set -eux; \
case "$TARGETARCH" in \
amd64) src=/release/mongodb-connector-x86_64-linux ;; \
arm64) src=/release/mongodb-connector-aarch64-linux ;; \
*) echo "unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;; \
esac; \
cp "$src" /mongodb-connector; \
chmod +x /mongodb-connector
FROM alpine:3.20
RUN apk add --no-cache jq ca-certificates
COPY --from=prep /mongodb-connector /usr/local/bin/mongodb-connector
COPY scripts/env-loader.sh /usr/local/bin/env-loader
RUN chmod +x /usr/local/bin/env-loader
# Match the defaults set in nix/docker-connector.nix.
ENV HASURA_CONFIGURATION_DIRECTORY=/etc/connector \
HASURA_CONNECTOR_PORT=8080 \
MONGODB_DATABASE_URI=mongodb://localhost/db \
OTEL_SERVICE_NAME=mongodb-connector \
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/env-loader", "/usr/local/bin/mongodb-connector"]
CMD ["serve"]