2025-07-23 00:31:56 +02:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
|
2025-08-08 15:50:44 -07:00
|
|
|
FROM rust:1.89.0 AS build
|
2020-07-23 22:46:33 +02:00
|
|
|
|
|
|
|
|
WORKDIR /usr/src/labrinth
|
|
|
|
|
COPY . .
|
2025-08-16 17:47:11 +02:00
|
|
|
ARG GIT_HASH
|
2025-07-23 00:31:56 +02:00
|
|
|
RUN --mount=type=cache,target=/usr/src/labrinth/target \
|
2025-10-08 18:03:15 +02:00
|
|
|
--mount=type=cache,target=/usr/local/cargo,from=rust:1.89.0,source=/usr/local/cargo \
|
|
|
|
|
SQLX_OFFLINE=true cargo build --profile release-labrinth --package labrinth
|
2025-07-23 00:31:56 +02:00
|
|
|
|
|
|
|
|
FROM build AS artifacts
|
|
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/usr/src/labrinth/target \
|
2025-10-08 18:03:15 +02:00
|
|
|
mkdir /labrinth \
|
|
|
|
|
&& cp /usr/src/labrinth/target/release-labrinth/labrinth /labrinth/labrinth \
|
|
|
|
|
&& cp -r /usr/src/labrinth/apps/labrinth/migrations /labrinth \
|
|
|
|
|
&& cp -r /usr/src/labrinth/apps/labrinth/assets /labrinth
|
2020-07-23 22:46:33 +02:00
|
|
|
|
2024-11-11 18:31:06 -08:00
|
|
|
FROM debian:bookworm-slim
|
2021-11-14 16:27:33 -07:00
|
|
|
|
2024-10-18 17:00:36 -07:00
|
|
|
LABEL org.opencontainers.image.source=https://github.com/modrinth/code
|
2025-08-16 17:47:11 +02:00
|
|
|
LABEL org.opencontainers.image.title=labrinth
|
2024-10-18 17:00:36 -07:00
|
|
|
LABEL org.opencontainers.image.description="Modrinth API"
|
2025-08-16 17:47:11 +02:00
|
|
|
LABEL org.opencontainers.image.licenses=AGPL-3.0-only
|
2024-10-18 17:00:36 -07:00
|
|
|
|
2021-11-14 16:27:33 -07:00
|
|
|
RUN apt-get update \
|
2025-10-08 18:03:15 +02:00
|
|
|
&& apt-get install -y --no-install-recommends ca-certificates dumb-init curl \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2021-11-14 16:27:33 -07:00
|
|
|
|
2025-07-23 00:31:56 +02:00
|
|
|
COPY --from=artifacts /labrinth /labrinth
|
2020-08-28 20:24:43 +02:00
|
|
|
|
2025-07-23 00:31:56 +02:00
|
|
|
WORKDIR /labrinth
|
2025-03-06 00:40:27 +01:00
|
|
|
ENTRYPOINT ["dumb-init", "--"]
|
|
|
|
|
CMD ["/labrinth/labrinth"]
|