Skip to content

Commit 4935eec

Browse files
committed
Merge remote-tracking branch 'upstream/master' into readme
2 parents c4c7d69 + f9665ca commit 4935eec

16 files changed

Lines changed: 371 additions & 13 deletions

File tree

.github/workflows/apps.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: build apps
2+
on:
3+
workflow_dispatch:
4+
workflow_run:
5+
workflows: [build base]
6+
types: [completed]
7+
branches:
8+
- master
9+
push:
10+
branches:
11+
- master
12+
paths:
13+
- apps/**
14+
- scripts/apps/**
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
jobs:
20+
check_changes:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
apps_json: ${{ steps.emit.outputs.apps_json }}
24+
steps:
25+
- if: ${{ github.event_name == 'push' }}
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- if: ${{ github.event_name == 'push' }}
31+
id: filter
32+
uses: dorny/paths-filter@v3
33+
with:
34+
filters: |
35+
postgresql_changed:
36+
- 'apps/postgresql/**'
37+
- 'scripts/apps/postgresql/**'
38+
uptime_kuma_2_changed:
39+
- 'apps/uptime-kuma-2/**'
40+
- 'scripts/apps/uptime-kuma-2/**'
41+
base_changed:
42+
- 'base/**'
43+
- 'scripts/base/ampstart.sh'
44+
45+
- id: emit
46+
shell: bash
47+
run: |
48+
set -euo pipefail
49+
# Default matrix when not a push: build all apps
50+
if [ "${{ github.event_name }}" != "push" ]; then
51+
echo 'apps_json=["postgresql","uptime-kuma-2"]' >> "$GITHUB_OUTPUT"
52+
exit 0
53+
fi
54+
55+
# On push: if base changed, build nothing (let base workflow handle rebuilds)
56+
if [ "${{ steps.filter.outputs.base_changed || 'false' }}" = "true" ]; then
57+
echo 'apps_json=[]' >> "$GITHUB_OUTPUT"
58+
exit 0
59+
fi
60+
61+
apps=()
62+
if [ "${{ steps.filter.outputs.postgresql_changed || 'false' }}" = "true" ]; then apps+=('"postgresql"'); fi
63+
if [ "${{ steps.filter.outputs.uptime_kuma_2_changed || 'false' }}" = "true" ]; then apps+=('"uptime-kuma-2"'); fi
64+
65+
if [ "${#apps[@]}" -eq 0 ]; then
66+
echo 'apps_json=[]' >> "$GITHUB_OUTPUT"
67+
else
68+
printf 'apps_json=[%s]\n' "$(IFS=,; echo "${apps[*]}")" >> "$GITHUB_OUTPUT"
69+
fi
70+
71+
build_and_push:
72+
needs: [check_changes]
73+
if: ${{ github.repository_owner == 'CubeCoders' && github.ref == 'refs/heads/master' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') }}
74+
name: 'amp:apps-${{ matrix.app }}'
75+
runs-on: ubuntu-latest
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
app: ${{ fromJSON(needs.check_changes.outputs.apps_json) }}
80+
81+
steps:
82+
- uses: actions/checkout@v4
83+
with:
84+
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
85+
86+
- uses: docker/setup-qemu-action@v3
87+
- uses: docker/setup-buildx-action@v3
88+
89+
- uses: docker/login-action@v3
90+
with:
91+
username: ${{ vars.DOCKERHUB_USERNAME }}
92+
password: ${{ secrets.DOCKERHUB_TOKEN }}
93+
94+
- uses: docker/build-push-action@v6
95+
with:
96+
context: .
97+
file: ./apps/${{ matrix.app }}/Dockerfile
98+
platforms: linux/amd64,linux/arm64/v8
99+
push: true
100+
pull: true
101+
tags: cubecoders/ampbase:${{ matrix.app }}
102+
cache-from: type=registry,ref=cubecoders/ampbase:${{ matrix.app }}
103+
cache-to: type=inline
104+
provenance: mode=max
105+
sbom: true
106+
107+
concurrency:
108+
group: ${{ github.workflow }}-${{ github.ref }}
109+
cancel-in-progress: false

.github/workflows/base.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ jobs:
4848
push: true
4949
tags: |
5050
cubecoders/ampbase:${{ matrix.base }}
51-
cache-from: type=gha,scope=${{ github.workflow }}-${{ matrix.base }}
52-
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-${{ matrix.base }}
51+
cache-from: type=registry,ref=cubecoders/ampbase:${{ matrix.base }}
52+
cache-to: type=inline
5353
provenance: mode=max
5454
sbom: true
5555

5656
update_description:
5757
if: ${{ github.repository_owner == 'CubeCoders' && github.ref == 'refs/heads/master' && always() }}
5858
needs: [build_and_push]
5959
runs-on: ubuntu-latest
60+
continue-on-error: true
61+
6062
steps:
6163
- uses: peter-evans/dockerhub-description@v4
6264
with:

.github/workflows/cleanup.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: cleanup tags
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- .github/workflows/cleanup.yml
9+
permissions:
10+
contents: read
11+
packages: write
12+
13+
jobs:
14+
cleanup:
15+
if: ${{ github.repository_owner == 'CubeCoders' && github.ref == 'refs/heads/master' }}
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
steps:
20+
- name: Delete named tags if they exist
21+
shell: bash
22+
env:
23+
ORG: cubecoders
24+
REPO: ampbase
25+
TAGS: 'debian-13'
26+
run: |
27+
set -u
28+
29+
TOKEN=$(
30+
curl -s -H "Content-Type: application/json" -X POST \
31+
-d "{\"username\":\"${{ vars.DOCKERHUB_USERNAME }}\",\"password\":\"${{ secrets.DOCKERHUB_TOKEN }}\"}" \
32+
https://hub.docker.com/v2/users/login/ | jq -r .token
33+
)
34+
35+
for tag in $TAGS; do
36+
echo "Processing tag: $tag"
37+
38+
check_code=$(curl -s -o /dev/null -w "%{http_code}" \
39+
-H "Authorization: JWT $TOKEN" \
40+
"https://hub.docker.com/v2/repositories/$ORG/$REPO/tags/$tag/")
41+
42+
if [[ "$check_code" == "200" ]]; then
43+
echo "Tag exists. Deleting…"
44+
del_code=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE \
45+
-H "Authorization: JWT $TOKEN" \
46+
"https://hub.docker.com/v2/repositories/$ORG/$REPO/tags/$tag/")
47+
48+
if [[ "$del_code" == "204" || "$del_code" == "202" ]]; then
49+
echo "Deleted: $tag"
50+
else
51+
echo "WARNING: Failed to delete $tag (HTTP $del_code). Continuing."
52+
fi
53+
54+
elif [[ "$check_code" == "404" ]]; then
55+
echo "Tag not found: $tag — skipping."
56+
57+
else
58+
echo "WARNING: Could not verify tag $tag (HTTP $check_code). Skipping."
59+
fi
60+
done
61+
62+
concurrency:
63+
group: ${{ github.workflow }}-${{ github.ref }}
64+
cancel-in-progress: false

.github/workflows/java.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ jobs:
7070
push: true
7171
pull: true
7272
tags: cubecoders/ampbase:java-${{ matrix.java }}
73-
cache-from: type=gha,scope=${{ github.workflow }}-${{ matrix.java }}
74-
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-${{ matrix.java }}
73+
cache-from: type=registry,ref=cubecoders/ampbase:java-${{ matrix.java }}
74+
cache-to: type=inline
7575
provenance: mode=max
7676
sbom: true
7777

.github/workflows/mono.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ jobs:
7070
push: true
7171
pull: true
7272
tags: cubecoders/ampbase:mono-${{ matrix.mono }}
73-
cache-from: type=gha,scope=${{ github.workflow }}-${{ matrix.mono }}
74-
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-${{ matrix.mono }}
73+
cache-from: type=registry,ref=cubecoders/ampbase:mono-${{ matrix.mono }}
74+
cache-to: type=inline
7575
provenance: mode=max
7676
sbom: true
7777

.github/workflows/python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ jobs:
7676
push: true
7777
pull: true
7878
tags: cubecoders/ampbase:python-${{ matrix.python }}
79-
cache-from: type=gha,scope=${{ github.workflow }}-${{ matrix.python }}
80-
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-${{ matrix.python }}
79+
cache-from: type=registry,ref=cubecoders/ampbase:python-${{ matrix.python }}
80+
cache-to: type=inline
8181
provenance: mode=max
8282
sbom: true
8383

.github/workflows/wine.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ jobs:
6969
push: true
7070
pull: true
7171
tags: cubecoders/ampbase:wine-common
72-
cache-from: type=gha,scope=${{ github.workflow }}-common
73-
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-common
72+
cache-from: type=registry,ref=cubecoders/ampbase:wine-common
73+
cache-to: type=inline
7474
provenance: mode=max
7575
sbom: true
7676

@@ -107,9 +107,9 @@ jobs:
107107
pull: true
108108
tags: cubecoders/ampbase:wine-${{ matrix.version }}
109109
cache-from: |
110-
type=gha,scope=${{ github.workflow }}-wine-common
111-
type=gha,scope=${{ github.workflow }}-wine-${{ matrix.version }}
112-
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-${{ matrix.version }}
110+
type=registry,ref=cubecoders/ampbase:wine-common
111+
type=registry,ref=cubecoders/ampbase:wine-${{ matrix.version }}
112+
cache-to: type=inline
113113
provenance: mode=max
114114
sbom: true
115115

apps/postgresql/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# PostgreSQL image for AMP containers
2+
# cubecoders/ampbase:postgresql
3+
4+
FROM cubecoders/ampbase:debian
5+
6+
LABEL org.opencontainers.image.licenses=MIT
7+
8+
ENV DEBIAN_FRONTEND="noninteractive"
9+
10+
# Install required packages
11+
RUN set -eux; \
12+
apt-get update; \
13+
apt-get install -o APT::Keep-Downloaded-Packages="false" -y --no-install-recommends \
14+
make build-essential flex bison perl libreadline-dev libicu-dev; \
15+
apt-get clean; \
16+
rm -rf /var/lib/apt/lists/*

apps/uptime-kuma-2/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Uptime Kuma 2 image for AMP containers
2+
# Based on https://github.com/louislam/uptime-kuma/blob/223cde831f09a49a317bc4e5926cc8a38a6fa3f2/docker/debian-base.dockerfile
3+
# cubecoders/ampbase:uptime-kuma-2
4+
5+
FROM cubecoders/ampbase:debian
6+
7+
LABEL org.opencontainers.image.licenses=MIT
8+
9+
ENV UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB="1"
10+
ENV AMP_ADDITIONAL_ENV_VARS="UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB"
11+
ENV DEBIAN_FRONTEND="noninteractive"
12+
13+
# Install required packages
14+
RUN set -eux; \
15+
apt-get update; \
16+
# Install base dependencies
17+
apt-get install -o APT::Keep-Downloaded-Packages="false" -y --no-install-recommends \
18+
sqlite3 ca-certificates iputils-ping util-linux; \
19+
# Install Apprise for notifications
20+
wget -qO- http://ftp.debian.org/debian/pool/main/a/apprise/ | grep -oP 'href="apprise_.*?all\.deb"' | sed 's/href="//;s/"//' | sort -V | tail -n 1 | xargs -I {} wget -qO apprise.deb http://ftp.debian.org/debian/pool/main/a/apprise/{}; \
21+
apt-get install -o APT::Keep-Downloaded-Packages="false" -y --no-install-recommends \
22+
./apprise.deb python3-paho-mqtt; \
23+
rm -f apprise.deb; \
24+
# Install cloudflared
25+
install -d -m 0755 /etc/apt/keyrings; \
26+
wget -qO- https://pkg.cloudflare.com/cloudflare-main.gpg | gpg --dearmor -o /etc/apt/keyrings/cloudflare-main.gpg; \
27+
printf 'Types: deb\nURIs: https://pkg.cloudflare.com/cloudflared\nSuites: any\nComponents: main\nSigned-By: /etc/apt/keyrings/cloudflare-main.gpg\n' | tee /etc/apt/sources.list.d/cloudflared.sources >/dev/null; \
28+
apt-get update; \
29+
apt-get install -o APT::Keep-Downloaded-Packages="false" -y --no-install-recommends -t stable \
30+
cloudflared; \
31+
# Install remaining dependencies
32+
apt-get install -o APT::Keep-Downloaded-Packages="false" -y --no-install-recommends \
33+
chromium fonts-indic fonts-noto fonts-noto-cjk mariadb-server; \
34+
apt-get clean; \
35+
rm -rf /var/lib/apt/lists/*
36+
37+
COPY ./scripts/apps/uptime-kuma-2/ampstart.sh /ampstart.sh
38+
RUN chmod +x /ampstart.sh
39+
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "/ampstart.sh"]
40+
CMD []
41+

python/3.10/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ FROM cubecoders/ampbase:debian
1717
LABEL org.opencontainers.image.licenses=MIT
1818

1919
ENV PIP_DISABLE_PIP_VERSION_CHECK="1"
20+
ENV AMP_ADDITIONAL_ENV_VARS="PIP_DISABLE_PIP_VERSION_CHECK"
2021
ENV DEBIAN_FRONTEND="noninteractive"
2122

2223
ARG PYTHON_VERSION="3.10"

0 commit comments

Comments
 (0)