Skip to content
Snippets Groups Projects

provenance/Dockerfile: Evolve to compile the rust provenance crate

Merged Antoine R. Dumont requested to merge mr/deploy-new-provenance into master
1 unresolved thread
Files
4
@@ -2,22 +2,53 @@ ARG REGISTRY=container-registry.softwareheritage.org/swh/infra/swh-apps/
ARG base_image=${REGISTRY}base
ARG base_image_version=latest
FROM ${base_image}:${base_image_version}
ARG userid=1000
ARG groupid=1000
ARG user=swh
ARG workdir=/opt/${user}
ARG configdir=/etc/${user}
FROM rust:1.85-bookworm AS rust_build
# ... build swh-graph rust deps
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y build-essential libclang-dev \
zstd protobuf-compiler default-jre && \
apt-get clean
# Install swh-graph feature swh-graph-grpc-serve
RUN --mount=type=cache,target=.cache,uid=1000,gid=1000 \
RUSTFLAGS="-C target-cpu=native" \
cargo install swh-provenance --locked
FROM ${base_image}:${base_image_version}
USER root
RUN apt-get update && \
apt-get install -y zstd && \
apt-get clean
FROM ${base_image}:${base_image_version}
COPY --chmod=0644 requirements-frozen.txt ${workdir}
RUN --mount=type=cache,target=.cache,uid=1000,gid=1000 \
uv pip sync requirements-frozen.txt
COPY --chmod=0755 entrypoint.sh ${workdir}
COPY --from=rust_build /usr/local/cargo/bin/swh-provenance* /usr/local/bin/
COPY --chmod=0755 entrypoint.sh ${workdir}
USER ${user}
ENV SWH_CONFIG_FILENAME=${configdir}/config.yml
# Default to be a rpc service
ENV PORT 5014
ENV PROVENANCE_TYPE "rpc"
# Possible other value for grpc kind
# ENV PORT 50141
# ENV PROVENANCE_TYPE "grpc"
EXPOSE $PORT
# For rpc type, this maps directly to gunicorn env variables
ENV WORKERS 8
ENV THREADS 2
ENV TIMEOUT 3600
Loading