Skip to content

Commit cd35bcb

Browse files
committed
Add docker images
1 parent 15c6e2a commit cd35bcb

4 files changed

Lines changed: 113 additions & 1 deletion

File tree

.github/dependabot.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ updates:
2323
update-types:
2424
- minor
2525
- patch
26-
dependency-type: production
26+
dependency-type: production
27+
28+
- package-ecosystem: "docker"
29+
directory: "/"
30+
labels: []
31+
schedule:
32+
interval: "weekly"

.github/workflows/dock.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
push:
3+
4+
jobs:
5+
build:
6+
name: Build & Push Docker Image
7+
runs-on: ubuntu-latest
8+
9+
needs: test
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- uses: docker/setup-buildx-action@v4
17+
18+
- uses: docker/login-action@v4
19+
with:
20+
registry: ghcr.io
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- uses: actions/checkout@v6
25+
26+
- id: version
27+
run: |
28+
TAG=v0.1.2
29+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
30+
echo "version=$(echo -n "$TAG" | cut -c '2-')" >> "$GITHUB_OUTPUT"
31+
32+
- uses: docker/build-push-action@v7
33+
with:
34+
tags: ghcr.io/n-e/actions-oidc-trigger:${{ steps.version.outputs.version }}-slim
35+
push: false
36+
target: slim
37+
cache-from: type=gha
38+
cache-to: type=gha,mode=max
39+
build-args: |
40+
TAG=${{ steps.version.outputs.tag }}
41+
42+
- uses: docker/build-push-action@v7
43+
with:
44+
tags: ghcr.io/n-e/actions-oidc-trigger:${{ steps.version.outputs.version }}-docker-cli
45+
push: false
46+
target: docker-cli
47+
cache-from: type=gha
48+
cache-to: type=gha,mode=max
49+
build-args: |
50+
TAG=${{ steps.version.outputs.tag }}
51+

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM node:24.14.0-trixie-slim AS base
2+
3+
ARG TAG
4+
5+
RUN npm i -g actions-oidc-trigger@$(echo -n "$TAG" | cut -c '2-')
6+
7+
8+
FROM base AS slim
9+
10+
RUN groupadd app && useradd app -g app -m
11+
12+
USER app
13+
14+
CMD [ "actions-oidc-trigger" ]
15+
16+
FROM base AS docker-cli
17+
18+
# In this image we don't switch to the app user as we need to be root to access the docker socket
19+
20+
COPY docker/add-docker-to-apt.sh ./
21+
22+
RUN ./add-docker-to-apt.sh && rm add-docker-to-apt.sh
23+
24+
# apt list --all-versions docker-ce
25+
ARG VERSION_STRING=5:29.2.1-1~debian.13~trixie
26+
27+
RUN apt update \
28+
&& apt install -y \
29+
docker-ce-cli=$VERSION_STRING \
30+
git \
31+
&& rm -rf /var/lib/apt/lists/*
32+
33+
CMD [ "actions-oidc-trigger" ]

docker/add-docker-to-apt.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# from https://docs.docker.com/engine/install/debian/
3+
4+
set -e
5+
6+
# Add Docker's official GPG key:
7+
apt update
8+
apt install -y ca-certificates curl
9+
install -m 0755 -d /etc/apt/keyrings
10+
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
11+
chmod a+r /etc/apt/keyrings/docker.asc
12+
13+
# Add the repository to Apt sources:
14+
tee /etc/apt/sources.list.d/docker.sources <<EOF
15+
Types: deb
16+
URIs: https://download.docker.com/linux/debian
17+
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
18+
Components: stable
19+
Signed-By: /etc/apt/keyrings/docker.asc
20+
EOF
21+
22+
apt update

0 commit comments

Comments
 (0)