* dist(docker): add `.dockerignore` as symlink to `.gitignore` This ensures that no files outside of version control are transferred to the Docker build context for Labrinth and Daedalus images, which significantly improves build speed (if a `target` directory is already present) and build reproducibility. * chore(dist/docker): simplify out unneeeded statements, move `SQLX_OFFLINE` env var setting to build command itself The latter approach ensures that developers building the image locally don't forget to set `SQLX_OFFLINE`, too. * dist(docker): add `curl` package to Labrinth image
24 lines
791 B
Docker
24 lines
791 B
Docker
FROM rust:1.88.0 AS build
|
|
|
|
WORKDIR /usr/src/labrinth
|
|
COPY . .
|
|
RUN SQLX_OFFLINE=true cargo build --release --package labrinth
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/modrinth/code
|
|
LABEL org.opencontainers.image.description="Modrinth API"
|
|
LABEL org.opencontainers.image.licenses=AGPL-3.0
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates openssl dumb-init curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=build /usr/src/labrinth/target/release/labrinth /labrinth/labrinth
|
|
COPY --from=build /usr/src/labrinth/apps/labrinth/migrations/* /labrinth/migrations/
|
|
COPY --from=build /usr/src/labrinth/apps/labrinth/assets /labrinth/assets
|
|
WORKDIR /labrinth
|
|
|
|
ENTRYPOINT ["dumb-init", "--"]
|
|
CMD ["/labrinth/labrinth"]
|