Skip to content

Commit a180429

Browse files
committedFeb 13, 2025··
chore: add tier 2 images
1 parent da5cef5 commit a180429

13 files changed

+368
-2
lines changed
 

‎.github/workflows/base.gmpy2-3.11.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Gmpy2 Python 3.11
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- "base/gmpy2/**"
8+
- ".github/workflows/base.gmpy2-3.11.yml"
9+
workflow_dispatch:
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
NAME: gmpy2
14+
TAG: 3.11-alpine
15+
16+
jobs:
17+
build-and-push-image:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}
39+
tags: |
40+
${{ env.TAG }}
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: base/${{ env.NAME }}
46+
file: base/${{ env.NAME }}/Dockerfile.3.11
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
push: true
50+
51+
cleanup-images:
52+
runs-on: ubuntu-latest
53+
needs: build-and-push-image
54+
permissions:
55+
contents: read
56+
packages: write
57+
concurrency:
58+
group: cleanup-images-gmpy2
59+
steps:
60+
- name: Get lower case repository name
61+
id: lower_repo
62+
run: |
63+
export REPO_NAME=${{ github.event.repository.name }}
64+
echo "repo_name=${REPO_NAME@L}" >> $GITHUB_OUTPUT
65+
66+
- name: Prune old packages
67+
uses: dataaxiom/ghcr-cleanup-action@v1
68+
with:
69+
token: ${{ secrets.GITHUB_TOKEN }}
70+
package: ${{ steps.lower_repo.outputs.repo_name }}/${{ env.NAME }}
71+
dry-run: false
72+
delete-untagged: true
73+
delete-ghost-images: true
74+
delete-partial-images: true

‎.github/workflows/base.gmpy2.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Gmpy2
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- "base/gmpy2/**"
8+
- ".github/workflows/base.gmpy2.yml"
9+
workflow_dispatch:
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
NAME: gmpy2
14+
TAG: alpine
15+
16+
jobs:
17+
build-and-push-image:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}
39+
tags: |
40+
${{ env.TAG }}
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: base/${{ env.NAME }}
46+
file: base/${{ env.NAME }}/Dockerfile
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
push: true
50+
51+
cleanup-images:
52+
runs-on: ubuntu-latest
53+
needs: build-and-push-image
54+
permissions:
55+
contents: read
56+
packages: write
57+
concurrency:
58+
group: cleanup-images-gmpy2
59+
steps:
60+
- name: Get lower case repository name
61+
id: lower_repo
62+
run: |
63+
export REPO_NAME=${{ github.event.repository.name }}
64+
echo "repo_name=${REPO_NAME@L}" >> $GITHUB_OUTPUT
65+
66+
- name: Prune old packages
67+
uses: dataaxiom/ghcr-cleanup-action@v1
68+
with:
69+
token: ${{ secrets.GITHUB_TOKEN }}
70+
package: ${{ steps.lower_repo.outputs.repo_name }}/${{ env.NAME }}
71+
dry-run: false
72+
delete-untagged: true
73+
delete-ghost-images: true
74+
delete-partial-images: true
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: PHP 7.4 with MariaDB
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- "base/php/**"
8+
- "base/php-mariadb/**"
9+
- ".github/workflows/base.php-7.4-mariadb.yml"
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
NAME: php-mariadb
15+
TAG: 7.4-alpine
16+
17+
jobs:
18+
build-and-push-image:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}
40+
tags: |
41+
${{ env.TAG }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: base/${{ env.NAME }}
47+
file: base/${{ env.NAME }}/Dockerfile.7.4
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
push: true
51+
52+
cleanup-images:
53+
runs-on: ubuntu-latest
54+
needs: build-and-push-image
55+
permissions:
56+
contents: read
57+
packages: write
58+
concurrency:
59+
group: cleanup-images-php-mariadb
60+
steps:
61+
- name: Get lower case repository name
62+
id: lower_repo
63+
run: |
64+
export REPO_NAME=${{ github.event.repository.name }}
65+
echo "repo_name=${REPO_NAME@L}" >> $GITHUB_OUTPUT
66+
67+
- name: Prune old packages
68+
uses: dataaxiom/ghcr-cleanup-action@v1
69+
with:
70+
token: ${{ secrets.GITHUB_TOKEN }}
71+
package: ${{ steps.lower_repo.outputs.repo_name }}/${{ env.NAME }}
72+
dry-run: false
73+
delete-untagged: true
74+
delete-ghost-images: true
75+
delete-partial-images: true
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: PHP 8 with MariaDB
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- "base/php/**"
8+
- "base/php-mariadb/**"
9+
- ".github/workflows/base.php-mariadb.yml"
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
NAME: php-mariadb
15+
TAG: alpine
16+
17+
jobs:
18+
build-and-push-image:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}
40+
tags: |
41+
${{ env.TAG }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: base/${{ env.NAME }}
47+
file: base/${{ env.NAME }}/Dockerfile
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
push: true
51+
52+
cleanup-images:
53+
runs-on: ubuntu-latest
54+
needs: build-and-push-image
55+
permissions:
56+
contents: read
57+
packages: write
58+
concurrency:
59+
group: cleanup-images-php-mariadb
60+
steps:
61+
- name: Get lower case repository name
62+
id: lower_repo
63+
run: |
64+
export REPO_NAME=${{ github.event.repository.name }}
65+
echo "repo_name=${REPO_NAME@L}" >> $GITHUB_OUTPUT
66+
67+
- name: Prune old packages
68+
uses: dataaxiom/ghcr-cleanup-action@v1
69+
with:
70+
token: ${{ secrets.GITHUB_TOKEN }}
71+
package: ${{ steps.lower_repo.outputs.repo_name }}/${{ env.NAME }}
72+
dry-run: false
73+
delete-untagged: true
74+
delete-ghost-images: true
75+
delete-partial-images: true

‎base/gmpy2/Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
FROM ghcr.io/gzctf/challenge-base/python:alpine
22

33
RUN pip install --no-cache-dir pycryptodome gmpy2
4-
5-
CMD ["sleep", "infinity"]

‎base/gmpy2/Dockerfile.3.11

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/gzctf/challenge-base/python:3.11-alpine
2+
3+
RUN pip install --no-cache-dir pycryptodome gmpy2

‎base/gmpy2/config.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"action_name": "Gmpy2",
4+
"tag": "alpine"
5+
},
6+
{
7+
"action_name": "Gmpy2 Python 3.11",
8+
"action_file": "gmpy2-3.11",
9+
"dockerfile": "Dockerfile.3.11",
10+
"tag": "3.11-alpine"
11+
}
12+
]

‎base/numpy/config.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[
2+
{
3+
"action_name": "Numpy"
4+
}
5+
]

‎base/php-mariadb/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ghcr.io/gzctf/challenge-base/php:alpine
2+
3+
RUN apk add --no-cache mariadb
4+
5+
COPY my.cnf /etc/mysql/my.cnf
6+
COPY --chmod=500 init.sh /init.sh

‎base/php-mariadb/Dockerfile.7.4

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ghcr.io/gzctf/challenge-base/php:7.4-alpine
2+
3+
RUN apk add --no-cache mariadb
4+
5+
COPY my.cnf /etc/mysql/my.cnf
6+
COPY --chmod=500 init.sh /init.sh

‎base/php-mariadb/config.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"action_name": "PHP 8 with MariaDB",
4+
"tag": "alpine",
5+
"depends_on": ["base/php/**"]
6+
},
7+
{
8+
"action_name": "PHP 7.4 with MariaDB",
9+
"action_file": "php-7.4-mariadb",
10+
"dockerfile": "Dockerfile.7.4",
11+
"tag": "7.4-alpine",
12+
"depends_on": ["base/php/**"]
13+
}
14+
]

‎base/php-mariadb/init.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
set -euo pipefail
4+
5+
echo $GZCTF_FLAG > /flag
6+
chmod 444 /flag
7+
unset GZCTF_FLAG
8+
9+
mkdir /run/mysqld
10+
chown www-data:www-data -R /var/lib/mysql /run/mysqld
11+
mysql_install_db --user=www-data --ldata=/var/lib/mysql
12+
13+
/usr/bin/mysqld --user=www-data --console --skip-name-resolve --skip-networking=0 &
14+
php-fpm -D
15+
nginx -g 'daemon off;'

‎base/php-mariadb/my.cnf

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[mysqld]
2+
user = www-data
3+
4+
skip-log-bin
5+
6+
character-set-server = utf8mb4
7+
max_connections = 10
8+
9+
log_warnings = 2

0 commit comments

Comments
 (0)
Please sign in to comment.