69 lines
2.1 KiB
Docker
69 lines
2.1 KiB
Docker
# rpki-explorer all-in-one image:
|
|
# - rpki_query_service (watch mode) + rpki_query_indexer
|
|
# - nginx serving the explorer SPA and proxying /api/v1/ to the query service
|
|
#
|
|
# Build context must be the repository root (rpki_2/rpki):
|
|
# docker build -f deploy/rpki-explorer/Dockerfile -t rpki-explorer:<tag> .
|
|
#
|
|
# Note: no `# syntax=` directive on purpose — the default images below are all
|
|
# expected to be present locally, and pulling the dockerfile frontend from
|
|
# docker.io may not be possible on offline build hosts.
|
|
|
|
ARG RUST_BUILDER_IMAGE=rust:1-bookworm
|
|
ARG NODE_BUILDER_IMAGE=node:slim
|
|
ARG RUNTIME_IMAGE=nginx:1.27-bookworm
|
|
|
|
FROM ${RUST_BUILDER_IMAGE} AS rust-builder
|
|
|
|
WORKDIR /src
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
ca-certificates \
|
|
clang \
|
|
cmake \
|
|
git \
|
|
libclang-dev \
|
|
make \
|
|
perl \
|
|
pkg-config \
|
|
python3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY . .
|
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
--mount=type=cache,target=/usr/local/cargo/git \
|
|
--mount=type=cache,target=/src/target \
|
|
cargo build --release --bin rpki_query_service --bin rpki_query_indexer \
|
|
&& cp target/release/rpki_query_service target/release/rpki_query_indexer /usr/local/bin/
|
|
|
|
FROM ${NODE_BUILDER_IMAGE} AS ui-builder
|
|
|
|
WORKDIR /ui
|
|
|
|
COPY ui/rpki-explorer/package.json ui/rpki-explorer/package-lock.json ./
|
|
RUN npm ci --no-audit --no-fund
|
|
|
|
COPY ui/rpki-explorer/ ./
|
|
RUN npm run build
|
|
|
|
FROM ${RUNTIME_IMAGE}
|
|
|
|
ARG GIT_REV=unknown
|
|
LABEL org.opencontainers.image.title="rpki-explorer" \
|
|
org.opencontainers.image.revision="${GIT_REV}"
|
|
|
|
COPY --from=rust-builder /usr/local/bin/rpki_query_service /usr/local/bin/rpki_query_service
|
|
COPY --from=rust-builder /usr/local/bin/rpki_query_indexer /usr/local/bin/rpki_query_indexer
|
|
COPY --from=ui-builder /ui/dist /usr/share/nginx/html
|
|
COPY deploy/rpki-explorer/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY deploy/rpki-explorer/entrypoint.sh /entrypoint.sh
|
|
|
|
RUN chmod +x /entrypoint.sh && mkdir -p /data
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|