cacheport

Ecosystem · System

Alpine apk package cache for image builds

Alpine images run apk add in nearly every Dockerfile. Point /etc/apk/repositories at Cacheport and packages come from your region, still verified against Alpine's signing keys.

CP-APKManifest
Upstream
dl-cdn.alpinelinux.org
Endpoint
https://acme.cacheport.cc/apk/
Config
/etc/apk/repositories
Access
Token or IP allowlist
APKINDEX
Refreshed every 15 minutes
.apk files
Cached forever, signatures verified by apk

How Alpine apk caching works

Each Alpine repository has an APKINDEX.tar.gz, signed by the Alpine developers, that lists packages and their checksums. apk verifies the index signature and every package checksum, so a cache in the middle cannot change what gets installed.

Alpine images include CA certificates, so the HTTPS endpoint works from the first line of a Dockerfile.

What gets cached
APKINDEX
Refreshed every 15 minutes per branch and architecture.
.apk packages
Cached forever.
Edge and testing
Supported, with the same refresh rules.

Set it up

Dockerfile

Dockerfile
FROM alpine:3.20
RUN sed -i "s|https://dl-cdn.alpinelinux.org|https://acme.cacheport.cc/apk|g" /etc/apk/repositories \
 && apk add --no-cache git curl

This form relies on an IP allowlist for your runners. To use a token, pass it as a build secret and put it in the repository URL as https://ci:TOKEN@acme.cacheport.cc/apk inside the same RUN step, so it never lands in an image layer.

Use it in CI

Store the token as a secret named CACHEPORT_TOKEN, then pick your provider.

GitHub Actions

.github/workflows/ci.yml
jobs:
  test:
    runs-on: ubuntu-latest
    container: alpine:3.20
    steps:
      - run: sed -i "s|https://dl-cdn.alpinelinux.org|https://acme.cacheport.cc/apk|g" /etc/apk/repositories
      - run: apk add --no-cache make gcc musl-dev
      - uses: actions/checkout@v4
      - run: make test

More for GitHub Actions: GitHub Actions setup guide.

GitLab CI

.gitlab-ci.yml
test:
  image: alpine:3.20
  before_script:
    - sed -i "s|https://dl-cdn.alpinelinux.org|https://acme.cacheport.cc/apk|g" /etc/apk/repositories
    - apk add --no-cache make gcc musl-dev
  script:
    - make test

More for GitLab CI: GitLab CI setup guide.

Base images from the cache too

The alpine image itself comes from Docker Hub. Pull it through the Docker Hub cache as acme.cacheport.cc/hub/library/alpine:3.20 and the whole build stays inside Cacheport.

Questions

Does apk still verify packages?

Yes. Signatures and checksums are checked by apk exactly as with the public CDN.

Which Alpine versions are supported?

Every branch available on dl-cdn.alpinelinux.org, including edge.

Does it work with Wolfi or Chainguard images?

Add their package repository as an upstream and rewrite its URL the same way.

Other ecosystems people set up next

Start on the free plan

20 GB of cache, every registry, unlimited users. Upgrade when your pipelines outgrow it.