Fix dockerfile not cross compiling correctly (#5294)

This commit is contained in:
Adrian Freund 2024-10-31 16:54:35 +01:00 committed by GitHub
parent b88ec6016e
commit 36f8cdf91b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View File

@ -36,18 +36,18 @@ jobs:
run: echo "TYPST_BUILD_DATE=\"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\" >> $GITHUB_ENV"
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3.1.0
uses: docker/setup-buildx-action@v3.7.1
with:
platforms: ${{ matrix.platform }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5.0.0
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.IMAGE_NAME }}
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3.0.0
uses: docker/login-action@v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@ -55,7 +55,7 @@ jobs:
- name: Build Docker image
id: build
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v6.9.0
with:
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platform }}

View File

@ -1,9 +1,6 @@
ARG CREATED
ARG REVISION
ARG TARGETPLATFORM
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM rust:alpine AS build
COPY --from=xx / /
RUN apk add --no-cache clang lld
@ -15,6 +12,8 @@ RUN --mount=type=cache,target=/root/.cargo/git/db \
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse \
cargo fetch
ARG TARGETPLATFORM
RUN xx-apk add --no-cache musl-dev openssl-dev openssl-libs-static
RUN --mount=type=cache,target=/root/.cargo/git/db \
--mount=type=cache,target=/root/.cargo/registry/cache \
@ -26,6 +25,8 @@ RUN --mount=type=cache,target=/root/.cargo/git/db \
xx-verify target/release/typst
FROM alpine:latest
ARG CREATED
ARG REVISION
LABEL org.opencontainers.image.authors="The Typst Project Developers <hello@typst.app>"
LABEL org.opencontainers.image.created=${CREATED}
LABEL org.opencontainers.image.description="A markup-based typesetting system"