Skip to content

Commit e9476ff

Browse files
committed
cleanup unused files and adapt github workflows
1 parent 2e78e15 commit e9476ff

34 files changed

+62
-4493
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#ECCN:Open Source
2-
#GUSINFO:Languages,Heroku Stacks & Images
3-
* @heroku/languages
4-
1+
* @ninech/platform-team

.github/workflows/ci.yml

Lines changed: 34 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
permissions:
1616
contents: read
17-
id-token: write
17+
packages: write
1818

1919
jobs:
2020
shellcheck:
@@ -34,10 +34,9 @@ jobs:
3434
fail-fast: false
3535
matrix:
3636
arch: ["amd64", "arm64"]
37-
stack-version: ["22", "24"]
38-
exclude:
39-
- arch: "arm64"
40-
stack-version: "22"
37+
stack-version: ["24"]
38+
env:
39+
DOCKER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/deploio-heroku
4140
steps:
4241
- name: Checkout
4342
uses: actions/checkout@v6
@@ -52,51 +51,16 @@ jobs:
5251
git diff
5352
exit 1
5453
fi
55-
- name: Generate Heroku runtime image files
56-
if: matrix.arch == 'amd64'
57-
run: |
58-
bin/generate-runtime-images.sh ${{ matrix.stack-version }}
5954
- name: Export base images from the Docker daemon
6055
if: github.ref_name == 'main' || github.ref_type == 'tag'
6156
run: |
62-
docker save $(docker images --format '{{.Repository}}:{{.Tag}}' | grep "heroku/heroku:${{ matrix.stack-version }}") | zstd -T0 --long=31 -o images.tar.zst
57+
docker save $(docker images --format '{{.Repository}}:{{.Tag}}' | grep "${DOCKER_IMAGE_NAME}:${{ matrix.stack-version }}") | zstd -T0 --long=31 -o images.tar.zst
6358
- name: Save OCI base image exports to the cache
6459
if: github.ref_name == 'main' || github.ref_type == 'tag'
6560
uses: actions/cache/save@v5
6661
with:
6762
key: ${{ github.run_id}}-${{ matrix.stack-version }}-${{ matrix.arch }}
6863
path: images.tar.zst
69-
- name: Save Heroku runtime image files to the cache
70-
if: matrix.arch == 'amd64' && github.ref_type == 'tag'
71-
uses: actions/cache/save@v5
72-
with:
73-
key: runtime-images-${{ github.run_id}}-${{ matrix.stack-version }}
74-
path: /tmp/heroku-${{ matrix.stack-version }}*
75-
76-
upload-runtime-images:
77-
if: github.ref_type == 'tag'
78-
name: "Upload heroku-${{ matrix.stack-version }} runtime images"
79-
needs:
80-
- build
81-
runs-on: ubuntu-24.04
82-
strategy:
83-
fail-fast: false
84-
matrix:
85-
stack-version: ["22", "24"]
86-
steps:
87-
- name: Checkout
88-
uses: actions/checkout@v6
89-
- name: Restore heroku runtime images from the cache
90-
uses: actions/cache/restore@v5
91-
with:
92-
fail-on-cache-miss: true
93-
key: runtime-images-${{ github.run_id}}-${{ matrix.stack-version }}
94-
path: /tmp/heroku-${{ matrix.stack-version }}*
95-
- name: Upload heroku runtime images to staging
96-
run: bin/upload-runtime-images.sh ${{ matrix.stack-version }} ${{ github.sha }}
97-
env:
98-
MANIFEST_APP_TOKEN: "${{ secrets.MANIFEST_APP_TOKEN }}"
99-
MANIFEST_APP_URL: "${{ secrets.MANIFEST_APP_URL }}"
10064

10165
publish-images:
10266
if: github.ref_name == 'main' || github.ref_type == 'tag'
@@ -106,14 +70,12 @@ jobs:
10670
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
10771
env:
10872
TAG_SUFFIX: ".${{ github.ref_type == 'tag' && github.ref_name || 'nightly' }}"
73+
DOCKER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/deploio-heroku
10974
strategy:
11075
fail-fast: false
11176
matrix:
11277
arch: ["amd64", "arm64"]
113-
stack-version: ["22", "24"]
114-
exclude:
115-
- arch: "arm64"
116-
stack-version: "22"
78+
stack-version: ["24"]
11779
steps:
11880
- name: Restore base images from the cache
11981
uses: actions/cache/restore@v5
@@ -125,34 +87,15 @@ jobs:
12587
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
12688
- name: Load Docker images into the Docker daemon
12789
run: zstd -dc --long=31 images.tar.zst | docker load
128-
- name: Log in to Docker Hub
129-
run: echo '${{ secrets.DOCKER_HUB_TOKEN }}' | docker login -u '${{ secrets.DOCKER_HUB_USERNAME }}' --password-stdin
130-
- name: Configure AWS credentials
131-
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1
132-
with:
133-
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ECR_ROLE }}
134-
aws-region: ${{ vars.AWS_REGION }}
135-
- name: Log in to Amazon ECR Public
136-
id: login-ecr-public
137-
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
138-
with:
139-
registry-type: public
140-
- name: Publish base images to registries
90+
- name: Log in to GitHub Container Registry
91+
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ghcr.io -u '${{ github.actor }}' --password-stdin
92+
- name: Publish base images to registry
14193
run: |
142-
variants=("" "-build")
143-
platformSuffix=""
144-
if (( ${{ matrix.stack-version }} >= 24 )); then
145-
platformSuffix="_linux-${{ matrix.arch }}"
146-
else
147-
variants+=("-cnb" "-cnb-build")
148-
fi
149-
for variant in "${variants[@]}"; do
150-
srcTag="heroku/heroku:${{ matrix.stack-version}}${variant}"
151-
destTag="${srcTag}${platformSuffix}${TAG_SUFFIX}"
152-
for host in "docker.io" "public.ecr.aws"; do
153-
docker tag "${srcTag}" "${host}/${destTag}"
154-
docker push "${host}/${destTag}"
155-
done
94+
for variant in "" "-build"; do
95+
srcTag="${DOCKER_IMAGE_NAME}:${{ matrix.stack-version }}${variant}"
96+
destTag="${srcTag}_linux-${{ matrix.arch }}${TAG_SUFFIX}"
97+
docker tag "${srcTag}" "${destTag}"
98+
docker push "${destTag}"
15699
done
157100
158101
publish-indices:
@@ -163,99 +106,54 @@ jobs:
163106
runs-on: ubuntu-24.04
164107
env:
165108
TAG_SUFFIX: ".${{ github.ref_type == 'tag' && github.ref_name || 'nightly' }}"
109+
DOCKER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/deploio-heroku
166110
strategy:
167111
fail-fast: false
168112
matrix:
169113
stack-version: ["24"]
170114
steps:
171-
- name: Log in to Docker Hub
172-
run: echo '${{ secrets.DOCKER_HUB_TOKEN }}' | docker login -u '${{ secrets.DOCKER_HUB_USERNAME }}' --password-stdin
173-
- name: Configure AWS credentials
174-
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1
175-
with:
176-
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ECR_ROLE }}
177-
aws-region: ${{ vars.AWS_REGION }}
178-
- name: Log in to Amazon ECR Public
179-
id: login-ecr-public
180-
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
181-
with:
182-
registry-type: public
115+
- name: Log in to GitHub Container Registry
116+
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ghcr.io -u '${{ github.actor }}' --password-stdin
183117
- name: Publish multi-arch image index
184118
run: |
185119
for variant in '' '-build'; do
186-
indexTag="heroku/heroku:${{ matrix.stack-version }}${variant}${TAG_SUFFIX}"
187-
armTag="heroku/heroku:${{ matrix.stack-version }}${variant}_linux-arm64${TAG_SUFFIX}"
188-
amdTag="heroku/heroku:${{ matrix.stack-version }}${variant}_linux-amd64${TAG_SUFFIX}"
189-
for host in 'docker.io' 'public.ecr.aws'; do
190-
docker buildx imagetools create \
191-
--tag "${host}/${indexTag}" \
192-
"${host}/${amdTag}" \
193-
"${host}/${armTag}"
194-
done
120+
indexTag="${DOCKER_IMAGE_NAME}:${{ matrix.stack-version }}${variant}${TAG_SUFFIX}"
121+
armTag="${DOCKER_IMAGE_NAME}:${{ matrix.stack-version }}${variant}_linux-arm64${TAG_SUFFIX}"
122+
amdTag="${DOCKER_IMAGE_NAME}:${{ matrix.stack-version }}${variant}_linux-amd64${TAG_SUFFIX}"
123+
docker manifest create "${indexTag}" "${amdTag}" "${armTag}"
124+
docker manifest push "${indexTag}"
195125
done
196126
197-
ctc-check:
198-
name: Obtain CTC Lock
199-
if: github.ref_type == 'tag'
200-
runs-on: ubuntu-24.04
201-
steps:
202-
- name: Obtain CTC Lock via TPS API
203-
run: |
204-
curl -sS --connect-timeout 5 --fail-with-body --retry-connrefused --retry 5 \
205-
-X PUT \
206-
-H "ACCEPT: application/json" \
207-
-H "Content-Type: application/json" \
208-
-H "Authorization: Token ${{ secrets.TPS_TOKEN }}" \
209-
-d '{"lock": {"sha": "${{ github.sha }}", "component_slug": "${{ vars.tps_component }}"}}' \
210-
"${{ secrets.TPS_CTC_API_URL }}"
211-
212127
promote-tags:
213128
if: github.ref_type == 'tag'
214129
name: "Promote heroku-${{ matrix.stack-version }} tags"
215130
needs:
216-
- ctc-check
217131
- publish-images
218132
- publish-indices
219133
runs-on: ubuntu-24.04
220134
strategy:
221135
fail-fast: false
222136
matrix:
223-
stack-version: ["22", "24"]
137+
stack-version: ["24"]
138+
env:
139+
DOCKER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/deploio-heroku
224140
steps:
225141
- name: Checkout
226142
uses: actions/checkout@v6
227-
- name: Log in to Docker Hub
228-
run: echo '${{ secrets.DOCKER_HUB_TOKEN }}' | docker login -u '${{ secrets.DOCKER_HUB_USERNAME }}' --password-stdin
229-
- name: Configure AWS credentials
230-
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1
231-
with:
232-
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ECR_ROLE }}
233-
aws-region: ${{ vars.AWS_REGION }}
234-
- name: Log in to Amazon ECR Public
235-
id: login-ecr-public
236-
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
237-
with:
238-
registry-type: public
143+
- name: Log in to GitHub Container Registry
144+
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ghcr.io -u '${{ github.actor }}' --password-stdin
239145
- name: Install crane
240146
uses: buildpacks/github-actions/setup-tools@f3ec16c6d708761c6e87bbc8fe7f97375f80e7cd # v5.10.1
241147
- name: Promote images to stable tag
242148
run: |
243149
destTags=( )
244-
if (( ${{ matrix.stack-version }} >= 24 )); then
245-
for variant in '' '-build'; do
246-
for arch in 'amd64' 'arm64'; do
247-
destTags+=("heroku/heroku:${{ matrix.stack-version }}${variant}_linux-${arch}")
248-
done
249-
destTags+=("heroku/heroku:${{ matrix.stack-version }}${variant}")
250-
done
251-
else
252-
for variant in '' '-build' '-cnb' '-cnb-build'; do
253-
destTags+=("heroku/heroku:${{ matrix.stack-version }}${variant}")
150+
for variant in '' '-build'; do
151+
for arch in 'amd64' 'arm64'; do
152+
destTags+=("${DOCKER_IMAGE_NAME}:${{ matrix.stack-version }}${variant}_linux-${arch}")
254153
done
255-
fi
154+
destTags+=("${DOCKER_IMAGE_NAME}:${{ matrix.stack-version }}${variant}")
155+
done
256156
for destTag in "${destTags[@]}"; do
257157
srcTag="${destTag}.${{ github.ref_name }}"
258-
for host in "docker.io" "public.ecr.aws"; do
259-
crane copy "${host}/${srcTag}" "${host}/${destTag}"
260-
done
158+
crane copy "${srcTag}" "${destTag}"
261159
done

BUILD.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,14 @@ Add the package you want to the appropriate `setup.sh` for example `heroku-24/se
2626
+ libc6-dev
2727
```
2828

29-
Once done, run `bin/build.sh` locally to generate the corresponding `installed-packages*` files. Multi-arch base images (heroku-24 and beyond) will produce an `installed-packages-$ARCH.txt` for each architecture, while single architecture images will produce a singular `installed-packages.txt`.
29+
Once done, run `bin/build.sh` locally to generate the corresponding `installed-packages*` files. Multi-arch base images (heroku-24 and beyond) will produce an `installed-packages-$ARCH.txt` for each architecture.
3030

3131
The `*-build` variants include all the packages from the non-build variant by default. This means that if you're adding a package to both, you only need to add them to the non-build variant. The example above will add `libc6-dev` to both `heroku-24` and `heroku-24-build`.
3232

33-
The `*cnb*` variants (which only exist for heroku-22 and prior) inherit the installed packages from the non-`*cnb*` variant. Add packages to a non-`*cnb*` variant to add them to the `*cnb*` variant.
33+
# Releasing Base Images
3434

35-
# Releasing Heroku Base Images
35+
We use GitHub Actions to build and release the base images:
3636

37-
We use GitHub Actions to build and release Heroku Base Images:
38-
39-
* Any push to `main` will build the images and push the nightly Docker tag variants (such as `heroku/heroku:24-build.nightly`).
40-
* Any new Git tag will build the image and push the latest Docker tag (such as `heroku/heroku:24-build`),
41-
as well as a versioned tag (such as `heroku/heroku:24-build.v123`). The `amd64` images will then also be
42-
converted to a Heroku-specific `.img` format and uploaded to S3 for consumption by the runtime hosts.
43-
44-
# Generating `.img` format Base Images locally
45-
46-
To test the generation of the Heroku-specific `.img` file:
47-
48-
1. Build the Docker images for your chosen stack as normal above.
49-
2. `docker buildx build --platform "linux/amd64,linux/arm64" -t heroku-image-tools ./tools`
50-
3. `docker run -it --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock heroku-image-tools STACK_VERSION` (where `STACK_VERSION` is a integer version like `24`)
51-
52-
You can also pass `--platform linux/amd64` or `--platform linux/arm64` to the `docker run` call above to test the generation for a specific architecture instead of using the same architecture as the host.
53-
54-
To get the resulting `.img.gz` and `.img.sha256` files written to a local output directory on the host machine, pass `-v <localoutdir>:/output` to the `docker run` call.
37+
* Any push to `main` will build the images and push the nightly GitHub Container Registry tag variants (such as `ghcr.io/ninech/deploio-heroku:24-build.nightly`).
38+
* Any new Git tag will build the image and push the latest GitHub Container Registry tag (such as `ghcr.io/ninech/deploio-heroku:24-build`),
39+
as well as a versioned tag (such as `ghcr.io/ninech/deploio-heroku:24-build.v123`).

README.md

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,20 @@
1-
## Heroku Base Images
2-
3-
[![CI](https://github.com/heroku/base-images/actions/workflows/ci.yml/badge.svg)](https://github.com/heroku/base-images/actions/workflows/ci.yml)
4-
5-
This repository holds recipes for building the base images for [Heroku stacks](https://devcenter.heroku.com/articles/stack).
6-
The recipes are also rendered into Docker images that are available on Docker Hub:
7-
8-
| Image | Type | OS | Supported Architectures | Default `USER` | Status |
9-
|-------------------------------------------|------------------------|--------------|-------------------------|----------------| -------------|
10-
| [heroku/heroku:20][heroku-tags] | Heroku Run Image | Ubuntu 20.04 | AMD64 | `root` | End-of-life |
11-
| [heroku/heroku:20-build][heroku-tags] | Heroku Build Image | Ubuntu 20.04 | AMD64 | `root` | End-of-life |
12-
| [heroku/heroku:20-cnb][heroku-tags] | CNB Run Image | Ubuntu 20.04 | AMD64 | `heroku` | End-of-life |
13-
| [heroku/heroku:20-cnb-build][heroku-tags] | CNB Build Image | Ubuntu 20.04 | AMD64 | `heroku` | End-of-life |
14-
| [heroku/heroku:22][heroku-tags] | Heroku Run Image | Ubuntu 22.04 | AMD64 | `root` | Available |
15-
| [heroku/heroku:22-build][heroku-tags] | Heroku Build Image | Ubuntu 22.04 | AMD64 | `root` | Available |
16-
| [heroku/heroku:22-cnb][heroku-tags] | CNB Run Image | Ubuntu 22.04 | AMD64 | `heroku` | Available |
17-
| [heroku/heroku:22-cnb-build][heroku-tags] | CNB Build Image | Ubuntu 22.04 | AMD64 | `heroku` | Available |
18-
| [heroku/heroku:24][heroku-tags] | Heroku/CNB Run Image | Ubuntu 24.04 | AMD64 + ARM64 | `heroku` | Recommended |
19-
| [heroku/heroku:24-build][heroku-tags] | Heroku/CNB Build Image | Ubuntu 24.04 | AMD64 + ARM64 | `heroku` | Recommended |
1+
## ninech/deploio-heroku Base Images
2+
3+
[![CI](https://github.com/ninech/heroku-stack-base-images/actions/workflows/ci.yml/badge.svg)](https://github.com/ninech/heroku-stack-base-images/actions/workflows/ci.yml)
4+
5+
This is a ninech fork of [heroku/base-images](https://github.com/heroku/base-images), adapted for use with [deplo.io](https://deplo.io).
6+
The recipes are rendered into Docker images available on the GitHub Container Registry:
7+
8+
| Image | Type | OS | Supported Architectures | Default `USER` | Status |
9+
|----------------------------------------------------|----------------|--------------|-------------------------|----------------|-------------|
10+
| [ghcr.io/ninech/deploio-heroku:24][ninech-tags] | Run Image | Ubuntu 24.04 | AMD64 + ARM64 | `deploio` | Recommended |
11+
| [ghcr.io/ninech/deploio-heroku:24-build][ninech-tags] | Build Image | Ubuntu 24.04 | AMD64 + ARM64 | `deploio` | Recommended |
2012

2113
The build image variants use the run images as their base, but include additional packages needed
2214
at build time such as development headers and compilation toolchains.
2315

24-
The CNB image variants contain additional metadata and changes required to make them compatible with
25-
Heroku's Cloud Native Buildpacks [builder images](https://github.com/heroku/cnb-builder-images).
26-
27-
For images where the default `USER` is `heroku`, you will need to switch back to the `root` user when
28-
modifying locations other then `/home/heroku` and `/tmp`. You can do this by adding `USER root` to
16+
For images where the default `USER` is `deploio`, you will need to switch back to the `root` user when
17+
modifying locations other than `/home/deploio` and `/tmp`. You can do this by adding `USER root` to
2918
your `Dockerfile` when building images, or by passing `--user root` to any `docker run` invocations.
3019

3120
### Learn more
@@ -35,5 +24,5 @@ your `Dockerfile` when building images, or by passing `--user root` to any `dock
3524

3625
See [BUILD.md](BUILD.md) for instructions on how to build the images yourself.
3726

38-
[heroku-tags]: https://hub.docker.com/r/heroku/heroku/tags
27+
[ninech-tags]: https://github.com/ninech/heroku-stack-base-images/pkgs/container/deploio-heroku
3928
[ubuntu-tags]: https://hub.docker.com/_/ubuntu?tab=tags

0 commit comments

Comments
 (0)