Skip to content

Commit f83b7c1

Browse files
committed
Rebase to 3.21, support read-only operation
1 parent 0d7048d commit f83b7c1

File tree

8 files changed

+82
-30
lines changed

8 files changed

+82
-30
lines changed

.github/workflows/external_trigger.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
2424
echo "> External trigger running off of master branch. To disable this trigger, add \`nginx_master\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY
2525
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
26-
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
26+
EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
2727
&& awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://')
2828
echo "Type is \`alpine_repo\`" >> $GITHUB_STEP_SUMMARY
2929
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
@@ -49,13 +49,30 @@ jobs:
4949
--header "Accept: application/vnd.oci.image.index.v1+json" \
5050
--header "Authorization: Bearer ${token}" \
5151
"https://ghcr.io/v2/${image}/manifests/${tag}")
52-
multidigest=$(jq -r ".manifests[] | select(.platform.architecture == \"amd64\").digest?" <<< "${multidigest}")
53-
digest=$(curl -s \
54-
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
55-
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
56-
--header "Authorization: Bearer ${token}" \
57-
"https://ghcr.io/v2/${image}/manifests/${multidigest}" \
58-
| jq -r '.config.digest')
52+
if jq -e '.layers // empty' <<< "${multidigest}" >/dev/null 2>&1; then
53+
# If there's a layer element it's a single-arch manifest so just get that digest
54+
digest=$(jq -r '.config.digest' <<< "${multidigest}")
55+
else
56+
# Otherwise it's multi-arch or has manifest annotations
57+
if jq -e '.manifests[]?.annotations // empty' <<< "${multidigest}" >/dev/null 2>&1; then
58+
# Check for manifest annotations and delete if found
59+
multidigest=$(jq 'del(.manifests[] | select(.annotations))' <<< "${multidigest}")
60+
fi
61+
if [[ $(jq '.manifests | length' <<< "${multidigest}") -gt 1 ]]; then
62+
# If there's still more than one digest, it's multi-arch
63+
multidigest=$(jq -r ".manifests[] | select(.platform.architecture == \"amd64\").digest?" <<< "${multidigest}")
64+
else
65+
# Otherwise it's single arch
66+
multidigest=$(jq -r ".manifests[].digest?" <<< "${multidigest}")
67+
fi
68+
if digest=$(curl -s \
69+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
70+
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
71+
--header "Authorization: Bearer ${token}" \
72+
"https://ghcr.io/v2/${image}/manifests/${multidigest}"); then
73+
digest=$(jq -r '.config.digest' <<< "${digest}");
74+
fi
75+
fi
5976
image_info=$(curl -sL \
6077
--header "Authorization: Bearer ${token}" \
6178
"https://ghcr.io/v2/${image}/blobs/${digest}")
@@ -79,7 +96,7 @@ jobs:
7996
if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
8097
echo "Version \`${EXT_RELEASE}\` already pushed, exiting" >> $GITHUB_STEP_SUMMARY
8198
exit 0
82-
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
99+
elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
83100
echo "New version \`${EXT_RELEASE}\` found; but not all arch repos updated yet; exiting" >> $GITHUB_STEP_SUMMARY
84101
FAILURE_REASON="New version ${EXT_RELEASE} for nginx tag latest is detected, however not all arch repos are updated yet. Will try again later."
85102
curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
@@ -100,7 +117,7 @@ jobs:
100117
else
101118
printf "\n## Trigger new build\n\n" >> $GITHUB_STEP_SUMMARY
102119
echo "New version \`${EXT_RELEASE}\` found; old version was \`${IMAGE_VERSION}\`. Triggering new build" >> $GITHUB_STEP_SUMMARY
103-
if "${artifacts_found}" == "true" ]]; then
120+
if [[ "${artifacts_found}" == "true" ]]; then
104121
echo "All artifacts seem to be uploaded." >> $GITHUB_STEP_SUMMARY
105122
fi
106123
response=$(curl -iX POST \

.github/workflows/package_trigger_scheduler.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,26 @@ jobs:
2727
fi
2828
printf "\n## Evaluating \`%s\`\n\n" ${br} >> $GITHUB_STEP_SUMMARY
2929
JENKINS_VARS=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-nginx/${br}/jenkins-vars.yml)
30-
if [[ "${br}" == $(yq -r '.ls_branch' <<< "${JENKINS_VARS}") ]]; then
30+
if ! curl -sfX GET https://raw.githubusercontent.com/linuxserver/docker-nginx/${br}/Jenkinsfile >/dev/null 2>&1; then
31+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
32+
echo "> No Jenkinsfile found. Branch is either deprecated or is an early dev branch." >> $GITHUB_STEP_SUMMARY
33+
skipped_branches="${skipped_branches}${br} "
34+
elif [[ "${br}" == $(yq -r '.ls_branch' <<< "${JENKINS_VARS}") ]]; then
3135
echo "Branch appears to be live; checking workflow." >> $GITHUB_STEP_SUMMARY
32-
if [[ $(yq -r '.skip_package_check' <<< "${JENKINS_VARS}") == "true" ]]; then
36+
README_VARS=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-nginx/${br}/readme-vars.yml)
37+
if [[ $(yq -r '.project_deprecation_status' <<< "${README_VARS}") == "true" ]]; then
38+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
39+
echo "> Branch appears to be deprecated; skipping trigger." >> $GITHUB_STEP_SUMMARY
40+
skipped_branches="${skipped_branches}${br} "
41+
elif [[ $(yq -r '.skip_package_check' <<< "${JENKINS_VARS}") == "true" ]]; then
3342
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
3443
echo "> Skipping branch ${br} due to \`skip_package_check\` being set in \`jenkins-vars.yml\`." >> $GITHUB_STEP_SUMMARY
3544
skipped_branches="${skipped_branches}${br} "
3645
elif grep -q "^nginx_${br}" <<< "${SKIP_PACKAGE_TRIGGER}"; then
3746
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
3847
echo "> Github organizational variable \`SKIP_PACKAGE_TRIGGER\` contains \`nginx_${br}\`; skipping trigger." >> $GITHUB_STEP_SUMMARY
3948
skipped_branches="${skipped_branches}${br} "
40-
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-nginx/job/${br}/lastBuild/api/json | jq -r '.building') == "true" ]; then
49+
elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-nginx/job/${br}/lastBuild/api/json | jq -r '.building' 2>/dev/null) == "true" ]; then
4150
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
4251
echo "> There already seems to be an active build on Jenkins; skipping package trigger for ${br}" >> $GITHUB_STEP_SUMMARY
4352
skipped_branches="${skipped_branches}${br} "
@@ -49,18 +58,26 @@ jobs:
4958
response=$(curl -iX POST \
5059
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-nginx/job/${br}/buildWithParameters?PACKAGE_CHECK=true \
5160
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
61+
if [[ -z "${response}" ]]; then
62+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
63+
echo "> Jenkins build could not be triggered. Skipping branch."
64+
continue
65+
fi
5266
echo "Jenkins [job queue url](${response%$'\r'})" >> $GITHUB_STEP_SUMMARY
5367
echo "Sleeping 10 seconds until job starts" >> $GITHUB_STEP_SUMMARY
5468
sleep 10
5569
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
5670
buildurl="${buildurl%$'\r'}"
5771
echo "Jenkins job [build url](${buildurl})" >> $GITHUB_STEP_SUMMARY
5872
echo "Attempting to change the Jenkins job description" >> $GITHUB_STEP_SUMMARY
59-
curl -iX POST \
73+
if ! curl -ifX POST \
6074
"${buildurl}submitDescription" \
6175
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
6276
--data-urlencode "description=GHA package trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
63-
--data-urlencode "Submit=Submit"
77+
--data-urlencode "Submit=Submit"; then
78+
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
79+
echo "> Unable to change the Jenkins job description."
80+
fi
6481
sleep 20
6582
fi
6683
else

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.20
3+
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.21
44

55
# set version label
66
ARG BUILD_DATE
@@ -13,7 +13,7 @@ LABEL maintainer="nemchik"
1313
# install packages
1414
RUN \
1515
if [ -z ${NGINX_VERSION+x} ]; then \
16-
NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
16+
NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
1717
&& awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
1818
fi && \
1919
apk add --no-cache \

Dockerfile.aarch64

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.20
3+
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.21
44

55
# set version label
66
ARG BUILD_DATE
@@ -13,7 +13,7 @@ LABEL maintainer="nemchik"
1313
# install packages
1414
RUN \
1515
if [ -z ${NGINX_VERSION+x} ]; then \
16-
NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
16+
NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
1717
&& awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
1818
fi && \
1919
apk add --no-cache \

Jenkinsfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pipeline {
2727
DEV_DOCKERHUB_IMAGE = 'lsiodev/nginx'
2828
PR_DOCKERHUB_IMAGE = 'lspipepr/nginx'
2929
DIST_IMAGE = 'alpine'
30-
DIST_TAG = '3.20'
31-
DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.20/main/'
30+
DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.21/main/'
3231
DIST_REPO_PACKAGES = 'nginx'
3332
MULTIARCH='true'
3433
CI='true'
@@ -579,7 +578,7 @@ pipeline {
579578
--label \"org.opencontainers.image.title=Nginx\" \
580579
--label \"org.opencontainers.image.description=[Nginx](https://nginx.org/) is a simple webserver with php support. The config files reside in `/config` for easy user customization.\" \
581580
--no-cache --pull -t ${IMAGE}:${META_TAG} --platform=linux/amd64 \
582-
--provenance=false --sbom=false --builder=container --load \
581+
--provenance=true --sbom=true --builder=container --load \
583582
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
584583
sh '''#! /bin/bash
585584
set -e
@@ -608,7 +607,9 @@ pipeline {
608607
for i in "${CACHE[@]}"; do
609608
docker push ${i}:amd64-${COMMIT_SHA}-${BUILD_NUMBER} &
610609
done
611-
wait
610+
for p in $(jobs -p); do
611+
wait "$p" || { echo "job $p failed" >&2; exit 1; }
612+
done
612613
fi
613614
'''
614615
}
@@ -643,7 +644,7 @@ pipeline {
643644
--label \"org.opencontainers.image.title=Nginx\" \
644645
--label \"org.opencontainers.image.description=[Nginx](https://nginx.org/) is a simple webserver with php support. The config files reside in `/config` for easy user customization.\" \
645646
--no-cache --pull -t ${IMAGE}:amd64-${META_TAG} --platform=linux/amd64 \
646-
--provenance=false --sbom=false --builder=container --load \
647+
--provenance=true --sbom=true --builder=container --load \
647648
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
648649
sh '''#! /bin/bash
649650
set -e
@@ -672,7 +673,9 @@ pipeline {
672673
for i in "${CACHE[@]}"; do
673674
docker push ${i}:amd64-${COMMIT_SHA}-${BUILD_NUMBER} &
674675
done
675-
wait
676+
for p in $(jobs -p); do
677+
wait "$p" || { echo "job $p failed" >&2; exit 1; }
678+
done
676679
fi
677680
'''
678681
}
@@ -700,7 +703,7 @@ pipeline {
700703
--label \"org.opencontainers.image.title=Nginx\" \
701704
--label \"org.opencontainers.image.description=[Nginx](https://nginx.org/) is a simple webserver with php support. The config files reside in `/config` for easy user customization.\" \
702705
--no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} --platform=linux/arm64 \
703-
--provenance=false --sbom=false --builder=container --load \
706+
--provenance=true --sbom=true --builder=container --load \
704707
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
705708
sh '''#! /bin/bash
706709
set -e
@@ -729,7 +732,9 @@ pipeline {
729732
for i in "${CACHE[@]}"; do
730733
docker push ${i}:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} &
731734
done
732-
wait
735+
for p in $(jobs -p); do
736+
wait "$p" || { echo "job $p failed" >&2; exit 1; }
737+
done
733738
fi
734739
'''
735740
}
@@ -972,7 +977,7 @@ pipeline {
972977
echo '{"tag_name":"'${META_TAG}'",\
973978
"target_commitish": "master",\
974979
"name": "'${META_TAG}'",\
975-
"body": "**CI Report:**\\n\\n'${CI_URL:-N/A}'\\n\\n**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Repo Changes:**\\n\\n' > start
980+
"body": "**CI Report:**\\n\\n'${CI_URL:-N/A}'\\n\\n**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Remote Changes:**\\n\\n' > start
976981
printf '","draft": false,"prerelease": false}' >> releasebody.json
977982
paste -d'\\0' start releasebody.json > releasebody.json.done
978983
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ The architectures supported by this image are:
6262
Add your web files to `/config/www` for hosting.
6363
Modify the nginx, php and site config files under `/config` as needed
6464

65+
## Read-Only Operation
66+
67+
This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/).
68+
69+
### Caveats
70+
71+
* `/tmp` must be mounted to tmpfs
72+
6573
## Usage
6674

6775
To help you get started creating a container from this image you can either use docker-compose or the docker cli.
@@ -116,6 +124,7 @@ Containers are configured using parameters passed at runtime (such as those abov
116124
| `-e PGID=1000` | for GroupID - see below for explanation |
117125
| `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). |
118126
| `-v /config` | Persistent config files |
127+
| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). |
119128

120129
## Environment variables from files (Docker secrets)
121130

@@ -279,6 +288,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
279288

280289
## Versions
281290

291+
* **17.12.24:** - Rebase to Alpine 3.21.
282292
* **31.05.24:** - Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings.
283293
* **05.03.24:** - Rebase to Alpine 3.19 with php 8.3.
284294
* **25.05.23:** - Rebase to Alpine 3.18, deprecate armhf.

jenkins-vars.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ repo_vars:
1515
- DEV_DOCKERHUB_IMAGE = 'lsiodev/nginx'
1616
- PR_DOCKERHUB_IMAGE = 'lspipepr/nginx'
1717
- DIST_IMAGE = 'alpine'
18-
- DIST_TAG = '3.20'
19-
- DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.20/main/'
18+
- DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.21/main/'
2019
- DIST_REPO_PACKAGES = 'nginx'
2120
- MULTIARCH='true'
2221
- CI='true'

readme-vars.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ param_usage_include_ports: true
2020
param_ports:
2121
- {external_port: "80", internal_port: "80", port_desc: "http"}
2222
- {external_port: "443", internal_port: "443", port_desc: "https"}
23+
readonly_supported: true
24+
readonly_message: |
25+
* `/tmp` must be mounted to tmpfs
2326
# application setup block
2427
app_setup_block_enabled: true
2528
app_setup_block: |
@@ -80,6 +83,7 @@ init_diagram: |
8083
"nginx:latest" <- Base Images
8184
# changelog
8285
changelogs:
86+
- {date: "17.12.24:", desc: "Rebase to Alpine 3.21."}
8387
- {date: "31.05.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings."}
8488
- {date: "05.03.24:", desc: "Rebase to Alpine 3.19 with php 8.3."}
8589
- {date: "25.05.23:", desc: "Rebase to Alpine 3.18, deprecate armhf."}

0 commit comments

Comments
 (0)