Dockerfile: add ENTRYPOINT directive (#3798)

This commit is contained in:
Pol Dellaiera 2024-04-16 11:40:08 +02:00 committed by GitHub
parent 401ba82927
commit 1f8454fa54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 3 deletions

View File

@ -32,6 +32,9 @@ jobs:
- name: Checkout repository
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
uses: docker/setup-buildx-action@v3.1.0
with:
@ -59,6 +62,9 @@ jobs:
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
REVISION=${{ github.sha }}
CREATED=${{ env.TYPST_BUILD_DATE }}
- name: Export digest
run: |

View File

@ -1,3 +1,7 @@
ARG CREATED
ARG REVISION
ARG TARGETPLATFORM
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM rust:alpine AS build
COPY --from=xx / /
@ -11,7 +15,6 @@ 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 \
@ -23,5 +26,16 @@ RUN --mount=type=cache,target=/root/.cargo/git/db \
xx-verify target/release/typst
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
ENTRYPOINT [ "/bin/typst" ]