dist(docker): add curl package to Labrinth image, some other minor tweaks (#3915)
* 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
This commit is contained in:
parent
2692953e31
commit
6caf794ae1
1
.dockerignore
Symbolic link
1
.dockerignore
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
.gitignore
|
||||||
5
.github/workflows/labrinth-docker.yml
vendored
5
.github/workflows/labrinth-docker.yml
vendored
@ -18,9 +18,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: ./apps/labrinth
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@ -38,8 +35,6 @@ jobs:
|
|||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
env:
|
|
||||||
SQLX_OFFLINE: true
|
|
||||||
with:
|
with:
|
||||||
file: ./apps/labrinth/Dockerfile
|
file: ./apps/labrinth/Dockerfile
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
FROM rust:1.88.0 AS build
|
FROM rust:1.88.0 AS build
|
||||||
ENV PKG_CONFIG_ALLOW_CROSS=1
|
|
||||||
|
|
||||||
WORKDIR /usr/src/daedalus
|
WORKDIR /usr/src/daedalus
|
||||||
COPY . .
|
COPY . .
|
||||||
@ -10,11 +9,8 @@ FROM debian:bookworm-slim
|
|||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends ca-certificates openssl \
|
&& apt-get install -y --no-install-recommends ca-certificates openssl \
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN update-ca-certificates
|
|
||||||
|
|
||||||
COPY --from=build /usr/src/daedalus/target/release/daedalus_client /daedalus/daedalus_client
|
COPY --from=build /usr/src/daedalus/target/release/daedalus_client /daedalus/daedalus_client
|
||||||
WORKDIR /daedalus_client
|
WORKDIR /daedalus_client
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
FROM rust:1.88.0 AS build
|
FROM rust:1.88.0 AS build
|
||||||
ENV PKG_CONFIG_ALLOW_CROSS=1
|
|
||||||
|
|
||||||
WORKDIR /usr/src/labrinth
|
WORKDIR /usr/src/labrinth
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY apps/labrinth/.sqlx/ .sqlx/
|
RUN SQLX_OFFLINE=true cargo build --release --package labrinth
|
||||||
RUN cargo build --release --package labrinth
|
|
||||||
|
|
||||||
|
|
||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
@ -14,12 +11,9 @@ LABEL org.opencontainers.image.description="Modrinth API"
|
|||||||
LABEL org.opencontainers.image.licenses=AGPL-3.0
|
LABEL org.opencontainers.image.licenses=AGPL-3.0
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends ca-certificates openssl dumb-init \
|
&& apt-get install -y --no-install-recommends ca-certificates openssl dumb-init curl \
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN update-ca-certificates
|
|
||||||
|
|
||||||
COPY --from=build /usr/src/labrinth/target/release/labrinth /labrinth/labrinth
|
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/migrations/* /labrinth/migrations/
|
||||||
COPY --from=build /usr/src/labrinth/apps/labrinth/assets /labrinth/assets
|
COPY --from=build /usr/src/labrinth/apps/labrinth/assets /labrinth/assets
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user