mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Dockerfile: add ENTRYPOINT
directive (#3798)
This commit is contained in:
parent
401ba82927
commit
1f8454fa54
6
.github/workflows/docker-image.yml
vendored
6
.github/workflows/docker-image.yml
vendored
@ -32,6 +32,9 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Get current date
|
||||||
|
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.1.0
|
||||||
with:
|
with:
|
||||||
@ -59,6 +62,9 @@ jobs:
|
|||||||
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
|
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
build-args: |
|
||||||
|
REVISION=${{ github.sha }}
|
||||||
|
CREATED=${{ env.TYPST_BUILD_DATE }}
|
||||||
|
|
||||||
- name: Export digest
|
- name: Export digest
|
||||||
run: |
|
run: |
|
||||||
|
18
Dockerfile
18
Dockerfile
@ -1,3 +1,7 @@
|
|||||||
|
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 / /
|
||||||
@ -11,7 +15,6 @@ 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 \
|
||||||
@ -23,5 +26,16 @@ 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
|
||||||
WORKDIR /root/
|
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"
|
||||||
|
LABEL org.opencontainers.image.documentation="https://typst.app/docs"
|
||||||
|
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
||||||
|
LABEL org.opencontainers.image.revision=${REVISION}
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/typst/typst"
|
||||||
|
LABEL org.opencontainers.image.title="Typst Docker image"
|
||||||
|
LABEL org.opencontainers.image.url="https://typst.app"
|
||||||
|
LABEL org.opencontainers.image.vendor="Typst"
|
||||||
|
|
||||||
COPY --from=build /app/target/release/typst /bin
|
COPY --from=build /app/target/release/typst /bin
|
||||||
|
ENTRYPOINT [ "/bin/typst" ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user