mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 03:01:48 +00:00
Cache individual layers of Docker container as it is being built.
Unfortunately this is still not enough to fit into codeberg-medium :(
This commit is contained in:
@@ -5,6 +5,9 @@ on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
FORGE: codeberg.org
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: codeberg-small-lazy
|
||||
@@ -79,25 +82,26 @@ jobs:
|
||||
apt-get -y install buildah ca-certificates
|
||||
- name: Check out source code
|
||||
uses: https://code.forgejo.org/actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||
- name: Authenticate with Docker
|
||||
run: |
|
||||
buildah login --authfile=/tmp/authfile-${FORGE}.json \
|
||||
-u ${{ vars.PACKAGES_USER }} -p ${{ secrets.PACKAGES_TOKEN }} ${FORGE}
|
||||
- name: Build container
|
||||
run: |
|
||||
printf '[storage]\ndriver="vfs"\nrunroot="/run/containers/storage"\ngraphroot="/var/lib/containers/storage"\n' | tee /etc/containers/storage.conf
|
||||
buildah build --arch=amd64 --tag=container:${VER}-amd64 .
|
||||
buildah build --arch=arm64 --tag=container:${VER}-arm64 .
|
||||
buildah build ${CACHE} --arch=amd64 --tag=container:${VER}-amd64
|
||||
buildah build ${CACHE} --arch=arm64 --tag=container:${VER}-arm64
|
||||
buildah manifest create container:${VER} \
|
||||
container:${VER}-amd64 \
|
||||
container:${VER}-arm64
|
||||
env:
|
||||
BUILDAH_ISOLATION: chroot
|
||||
VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
|
||||
CACHE: ${{ format('--authfile=/tmp/authfile-{0}.json --layers --cache-from {0}/{1}/cache --cache-to {0}/{1}/cache', env.FORGE, forge.repository) }}
|
||||
- if: ${{ forge.repository == 'git-pages/git-pages' }}
|
||||
name: Push container to Codeberg
|
||||
run: |
|
||||
buildah login --authfile=/tmp/authfile-${FORGE}.json \
|
||||
-u ${{ vars.PACKAGES_USER }} -p ${{ secrets.PACKAGES_TOKEN }} ${FORGE}
|
||||
buildah manifest push --authfile=/tmp/authfile-${FORGE}.json \
|
||||
--all container:${VER} "docker://${FORGE}/${{ forge.repository }}:${VER/v/}"
|
||||
env:
|
||||
BUILDAH_ISOLATION: chroot
|
||||
FORGE: codeberg.org
|
||||
VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
|
||||
|
||||
@@ -8,14 +8,12 @@ RUN apk --no-cache add git
|
||||
WORKDIR /build
|
||||
RUN git clone https://github.com/ochinchina/supervisord . && \
|
||||
git checkout 16cb640325b3a4962b2ba17d68fb5c2b1e1b6b3c
|
||||
RUN GOBIN=/usr/bin go install -ldflags "-s -w" && \
|
||||
go clean -cache -modcache
|
||||
RUN GOBIN=/usr/bin go install -ldflags "-s -w"
|
||||
|
||||
# Build Caddy with S3 storage backend.
|
||||
FROM docker.io/library/caddy:2.10.2-builder@sha256:6e3ed727ce8695fc58e0a8de8e5d11888f6463c430ea5b40e0b5f679ab734868 AS caddy-builder
|
||||
RUN xcaddy build ${CADDY_VERSION} \
|
||||
--with=github.com/ss098/certmagic-s3@v0.0.0-20250922022452-8af482af5f39 && \
|
||||
go clean -cache -modcache
|
||||
--with=github.com/ss098/certmagic-s3@v0.0.0-20250922022452-8af482af5f39
|
||||
|
||||
# Build git-pages.
|
||||
FROM docker.io/library/golang:1.25-alpine@sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb AS git-pages-builder
|
||||
@@ -25,8 +23,7 @@ COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY *.go ./
|
||||
COPY src/ ./src/
|
||||
RUN go build -ldflags "-s -w" -o git-pages . && \
|
||||
go clean -cache -modcache
|
||||
RUN go build -ldflags "-s -w" -o git-pages .
|
||||
|
||||
# Compose git-pages and Caddy.
|
||||
FROM docker.io/library/busybox:1.37.0-musl@sha256:ef13e7482851632be3faf5bd1d28d4727c0810901d564b35416f309975a12a30
|
||||
|
||||
Reference in New Issue
Block a user