mirror of
https://github.com/typst/typst
synced 2025-05-13 12:36:23 +08:00
Fix dockerfile not cross compiling correctly (#5294)
This commit is contained in:
parent
b88ec6016e
commit
36f8cdf91b
8
.github/workflows/docker-image.yml
vendored
8
.github/workflows/docker-image.yml
vendored
@ -36,18 +36,18 @@ jobs:
|
|||||||
run: echo "TYPST_BUILD_DATE=\"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\" >> $GITHUB_ENV"
|
run: echo "TYPST_BUILD_DATE=\"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\" >> $GITHUB_ENV"
|
||||||
|
|
||||||
- name: Setup Docker buildx
|
- name: Setup Docker buildx
|
||||||
uses: docker/setup-buildx-action@v3.1.0
|
uses: docker/setup-buildx-action@v3.7.1
|
||||||
with:
|
with:
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
|
|
||||||
- name: Extract Docker metadata
|
- name: Extract Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5.0.0
|
uses: docker/metadata-action@v5.5.1
|
||||||
with:
|
with:
|
||||||
images: ${{ env.IMAGE_NAME }}
|
images: ${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
uses: docker/login-action@v3.0.0
|
uses: docker/login-action@v3.3.0
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
id: build
|
id: build
|
||||||
uses: docker/build-push-action@v5.1.0
|
uses: docker/build-push-action@v6.9.0
|
||||||
with:
|
with:
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
ARG CREATED
|
|
||||||
ARG REVISION
|
|
||||||
ARG TARGETPLATFORM
|
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
|
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
|
||||||
FROM --platform=$BUILDPLATFORM rust:alpine AS build
|
FROM --platform=$BUILDPLATFORM rust:alpine AS build
|
||||||
|
|
||||||
COPY --from=xx / /
|
COPY --from=xx / /
|
||||||
|
|
||||||
RUN apk add --no-cache clang lld
|
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_REGISTRIES_CRATES_IO_PROTOCOL=sparse \
|
||||||
cargo fetch
|
cargo fetch
|
||||||
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
RUN xx-apk add --no-cache musl-dev openssl-dev openssl-libs-static
|
RUN xx-apk add --no-cache musl-dev openssl-dev openssl-libs-static
|
||||||
RUN --mount=type=cache,target=/root/.cargo/git/db \
|
RUN --mount=type=cache,target=/root/.cargo/git/db \
|
||||||
--mount=type=cache,target=/root/.cargo/registry/cache \
|
--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
|
xx-verify target/release/typst
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
ARG CREATED
|
||||||
|
ARG REVISION
|
||||||
LABEL org.opencontainers.image.authors="The Typst Project Developers <hello@typst.app>"
|
LABEL org.opencontainers.image.authors="The Typst Project Developers <hello@typst.app>"
|
||||||
LABEL org.opencontainers.image.created=${CREATED}
|
LABEL org.opencontainers.image.created=${CREATED}
|
||||||
LABEL org.opencontainers.image.description="A markup-based typesetting system"
|
LABEL org.opencontainers.image.description="A markup-based typesetting system"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user