Repository navigation
Expand file tree
/
Copy pathDockerfile.prebuilt
More file actions
73 lines (61 loc) · 2.97 KB
/
Copy pathDockerfile.prebuilt
File metadata and controls
73 lines (61 loc) · 2.97 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Dockerfile.prebuilt — astra-server runtime image (no Rust compilation)
#
# Prerequisites: pre-built binaries must exist at:
# target/x86_64-unknown-linux-gnu/release/astra-server
# target/x86_64-unknown-linux-gnu/release/astra
#
# Build with cargo-zigbuild first (run from the repo root):
# cargo zigbuild --release --no-default-features \
# --target x86_64-unknown-linux-gnu \
# -p astra-runtime --bin astra-server \
# -p astra-cli --bin astra
#
# Then build the image (build context = repo root):
# docker buildx build --platform linux/amd64 -f Dockerfile.prebuilt -t astra-server:TAG .
FROM debian:bookworm-slim@sha256:7c7b2c966bc9ee8cedfeef67e0e279108992c77681fa595db4a9d65c06ccc587
ARG IMAGE_VERSION=dev
ARG IMAGE_REVISION=unknown
ARG IMAGE_BRANCH=unknown
LABEL org.opencontainers.image.title="Astra" \
org.opencontainers.image.description="Astra API server and CLI runtime image (prebuilt)" \
org.opencontainers.image.url="https://github.com/matrixorigin/Astra" \
org.opencontainers.image.source="https://github.com/matrixorigin/Astra" \
org.opencontainers.image.documentation="https://github.com/matrixorigin/Astra#readme" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.vendor="MatrixOrigin" \
org.opencontainers.image.version="${IMAGE_VERSION}" \
org.opencontainers.image.revision="${IMAGE_REVISION}" \
org.opencontainers.image.ref.name="${IMAGE_BRANCH}"
ARG DEBIAN_MIRROR
# Docker exposes standard proxy build arguments to RUN instructions without an
# ARG declaration. Keeping them out of ARG and ENV prevents proxy credentials
# from being persisted in image metadata or the final runtime configuration.
WORKDIR /app
RUN set -eux; \
if [ -n "${DEBIAN_MIRROR:-}" ]; then \
mirror="${DEBIAN_MIRROR%/}"; \
case "${mirror}" in http://*|https://*) ;; *) mirror="https://${mirror}" ;; esac; \
find /etc/apt -type f \( -name 'sources.list' -o -name '*.sources' \) -print0 \
| xargs -0 -r sed -i -E "s#https?://(deb.debian.org|security.debian.org)#${mirror}#g"; \
fi; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates curl libssl3; \
rm -rf /var/lib/apt/lists/*; \
groupadd --gid 10001 appgroup; \
useradd --uid 10001 --gid 10001 --create-home --home-dir /home/appuser \
--shell /usr/sbin/nologin appuser
COPY target/x86_64-unknown-linux-gnu/release/astra-server /usr/local/bin/astra-server
COPY target/x86_64-unknown-linux-gnu/release/astra /usr/local/bin/astra
COPY LICENSE /usr/share/licenses/astra/LICENSE
RUN chown root:appgroup /app && \
chmod 0770 /app && \
chmod 0444 /usr/share/licenses/astra/LICENSE
USER 10001:10001
EXPOSE 17001
ENV HOME=/home/appuser
ENV ASTRA_API_HOST=0.0.0.0
ENV ASTRA_API_PORT=17001
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -fsS http://localhost:17001/health >/dev/null || exit 1
STOPSIGNAL SIGTERM
CMD ["astra-server"]