Skip to content

Commit

Permalink
Build multiarch alpine core image
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Oct 18, 2024
1 parent e0f6fc7 commit 4cfdfcf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
38 changes: 32 additions & 6 deletions .github/workflows/edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
paths:
- edge/alpine/Dockerfile
- .github/workflows/edge.yaml
schedule:
# Rebuild on the 17th of each month
- cron: '19 1 17 * *'
Expand Down Expand Up @@ -47,21 +48,46 @@ jobs:
driver: cloud
endpoint: "pandoc/multiarch"

- name: Docker meta
id: meta
- name: Meta for minimal
id: meta-minimal
uses: docker/metadata-action@v5
with:
images: |
pandoc/minimal
ghcr.io/pandoc/minimal
- name: Build and push edge image
uses: docker/build-push-action@v5
- name: 'pandoc/minimal:edge-alpine'
uses: docker/build-push-action@v6
with:
context: '.'
file: 'edge/alpine/Dockerfile'
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta-minimal.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: ${{ env.PUSH_IMAGE }}
tags: 'pandoc/minimal:edge-alpine'
target: minimal
tags: |
pandoc/minimal:edge-alpine
ghcr.io/pandoc/minimal:edge-alpine
- name: Meta for core
id: meta-core
uses: docker/metadata-action@v5
with:
images: |
pandoc/core
ghcr.io/pandoc/core
- name: 'pandoc/core:edge-alpine'
uses: docker/build-push-action@v6
with:
file: 'edge/alpine/Dockerfile'
labels: ${{ steps.meta-core.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: ${{ env.PUSH_IMAGE }}
target: core
tags: |
pandoc/core:edge
pandoc/core:edge-alpine
ghcr.io/pandoc/core:edge
ghcr.io/pandoc/core:edge-alpine
16 changes: 14 additions & 2 deletions edge/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ RUN apk --no-cache add \
yaml \
zlib-dev

RUN cabal update
RUN <<EOF
set -ex;
curl -sSL \
Expand All @@ -31,6 +30,7 @@ printf 'extra-packages: pandoc-crossref\n' > cabal.project.local;
# Build pandoc and pandoc-crossref. The `allow-newer` is required for
# when pandoc-crossref has not been updated yet, but we want to build
# anyway.
cabal update
cabal build \
--jobs \
--disable-tests \
Expand All @@ -51,10 +51,12 @@ find dist-newstyle \
-name 'pandoc*' -type f -perm -u+x \
-exec strip '{}' ';' \
-exec cp '{}' /usr/local/bin/ ';'

rm -rf /root/.cabal
EOF

# Minimal ###############################################################
FROM alpine:$base_image_version AS alpine-minimal
FROM alpine:$base_image_version AS minimal
ARG pandoc_version=edge
LABEL maintainer='Albert Krewinkel <albert+pandoc@zeitkraut.de>'
LABEL org.pandoc.maintainer='Albert Krewinkel <albert+pandoc@zeitkraut.de>'
Expand All @@ -76,3 +78,13 @@ RUN ln -s /usr/local/bin/pandoc /usr/local/bin/pandoc-lua && \
gmp \
libffi \
lua5.4

# Core ##################################################################
FROM minimal AS core
COPY --from=alpine-builder \
/usr/local/bin/pandoc-crossref \
/usr/local/bin/

# Additional packages frequently used during conversions
# NOTE: `libsrvg`, pandoc uses `rsvg-convert` for working with svg images.
RUN apk --no-cache add rsvg-convert

0 comments on commit 4cfdfcf

Please sign in to comment.