Skip to content

Commit 7d874e0

Browse files
authored
Merge pull request #234 from nanos/container-tags
Tag container images with stable, and with major and minor versions
2 parents 89eeeb4 + 53114fb commit 7d874e0

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

‎.github/workflows/update-version-number.yaml‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,31 @@ jobs:
5353
registry: ghcr.io
5454
username: ${{ github.actor }}
5555
password: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Work out the image tags
57+
id: tags
58+
env:
59+
REF: ${{ github.ref_name }}
60+
IMAGE: ghcr.io/${{ github.repository_owner }}/fedifetcher
61+
run: |
62+
{
63+
echo "tags<<EOF"
64+
echo "$IMAGE:$REF"
65+
echo "$IMAGE:latest"
66+
# Only an unsuffixed vX.Y.Z tag is a stable release; v8.1.0-rc1 is not.
67+
# Pre-releases must not move the major and minor tags: someone pinned
68+
# to v8 is asking for 8.x patches, not for a release candidate.
69+
if [[ "$REF" =~ ^v([0-9]+)\.([0-9]+)\.[0-9]+$ ]]; then
70+
echo "$IMAGE:stable"
71+
echo "$IMAGE:v${BASH_REMATCH[1]}"
72+
echo "$IMAGE:v${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
73+
fi
74+
echo "EOF"
75+
} >> "$GITHUB_OUTPUT"
5676
- name: Build and push
5777
id: docker_build
5878
uses: docker/build-push-action@v7
5979
with:
6080
context: .
6181
push: true
6282
platforms: linux/amd64,linux/arm64
63-
tags: |
64-
ghcr.io/${{ github.repository_owner }}/fedifetcher:${{ github.ref_name }}
65-
ghcr.io/${{ github.repository_owner }}/fedifetcher:latest
83+
tags: ${{ steps.tags.outputs.tags }}

‎examples/docker-compose.yaml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ services:
33
fedifetcher:
44
stdin_open: true
55
tty: true
6-
image: ghcr.io/nanos/fedifetcher:latest
6+
# `stable` is the latest stable release. Other tags, including pinning to a
7+
# major or minor version, are described at
8+
# https://github.com/nanos/FediFetcher/wiki/Running-FediFetcher-from-a-container#choosing-a-tag
9+
image: ghcr.io/nanos/fedifetcher:stable
710
# We override the Dockerfile entrypoint, run the python code with our commands, then append our sleep command: resume after a minute.
811
entrypoint: ["sh", "-c", "python /app/find_posts.py; sleep 60; "]
912
environment:

‎examples/k8s-cronjob.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spec:
4646
restartPolicy: Never
4747
containers:
4848
- name: fedifetcher
49-
image: ghcr.io/nanos/fedifetcher:latest
49+
image: ghcr.io/nanos/fedifetcher:stable
5050
imagePullPolicy: IfNotPresent
5151
env:
5252
- name: FF_HOME_TIMELINE_LENGTH
@@ -82,3 +82,9 @@ spec:
8282
claimName: fedifetcher-pvc
8383
```
8484
85+
`stable` is the latest stable release. Other tags, including pinning to a major or minor version, are described in [Running FediFetcher from a container](https://github.com/nanos/FediFetcher/wiki/Running-FediFetcher-from-a-container#choosing-a-tag).
86+
87+
> [!NOTE]
88+
>
89+
> `imagePullPolicy: IfNotPresent` will not pick up a new image when a floating tag such as `stable` moves. Use `Always`, or pin to a version tag, if you want updates.
90+

0 commit comments

Comments
 (0)