Skip to content

Commit 53b4121

Browse files
authored
Merge pull request #693 from linuxserver/universal-docker-update
universal-docker update/add workflows
2 parents 2355e67 + c502384 commit 53b4121

File tree

5 files changed

+72
-109
lines changed

5 files changed

+72
-109
lines changed

.github/workflows/BuildImage.yml

Lines changed: 34 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,47 @@
11
name: Build Image
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on: [push, pull_request_target, workflow_dispatch]
44

55
env:
6+
GITHUB_REPO: "linuxserver/docker-mods" #don't modify
67
ENDPOINT: "linuxserver/mods" #don't modify
78
BASEIMAGE: "universal" #replace
89
MODNAME: "docker" #replace
910

1011
jobs:
11-
build:
12+
set-vars:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/[email protected]
15-
16-
- name: Build image
17-
run: |
18-
# Set version
19-
if [ -z ${COMPOSE_RELEASE+x} ]; then COMPOSE_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); fi
20-
if [ -z ${DOCKER_RELEASE+x} ]; then DOCKER_RELEASE=$(curl -sX GET "https://api.github.com/repos/moby/moby/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); fi
21-
COMBINED_VERSION=${DOCKER_RELEASE}-${COMPOSE_RELEASE}
22-
echo "**** Combined version is ${COMBINED_VERSION} ****"
23-
echo "COMBINED_VERSION=${COMBINED_VERSION}" >> $GITHUB_ENV
24-
if curl -fSsL "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_RELEASE}.tgz" >/dev/null && curl -fSsL "https://download.docker.com/linux/static/stable/armhf/docker-${DOCKER_RELEASE}.tgz" >/dev/null && curl -fSsL "https://download.docker.com/linux/static/stable/aarch64/docker-${DOCKER_RELEASE}.tgz" >/dev/null; then echo "Docker tarballs exist, proceeding"; else echo "Docker tarballs are missing, exiting!" && exit 1; fi
25-
# Build image
26-
docker build --no-cache --build-arg COMPOSE_RELEASE=${COMPOSE_RELEASE} --build-arg DOCKER_RELEASE=${DOCKER_RELEASE} -t ${{ github.sha }} .
27-
28-
- name: Tag image
29-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
30-
run: |
31-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
32-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
33-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
34-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
35-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
36-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
37-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
38-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
39-
40-
- name: Credential check
41-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
42-
run: |
43-
echo "CR_USER=${{ secrets.CR_USER }}" >> $GITHUB_ENV
44-
echo "CR_PAT=${{ secrets.CR_PAT }}" >> $GITHUB_ENV
45-
echo "DOCKERUSER=${{ secrets.DOCKERUSER }}" >> $GITHUB_ENV
46-
echo "DOCKERPASS=${{ secrets.DOCKERPASS }}" >> $GITHUB_ENV
47-
if [[ "${{ secrets.CR_USER }}" == "" && "${{ secrets.CR_PAT }}" == "" && "${{ secrets.DOCKERUSER }}" == "" && "${{ secrets.DOCKERPASS }}" == "" ]]; then
48-
echo "::error::Push credential secrets missing."
49-
echo "::error::You must set either CR_USER & CR_PAT or DOCKERUSER & DOCKERPASS as secrets in your repo settings."
50-
echo "::error::See https://github.com/linuxserver/docker-mods/blob/master/README.md for more information/instructions."
51-
exit 1
52-
fi
53-
54-
- name: Login to GitHub Container Registry
55-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
56-
run: |
57-
echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ secrets.CR_USER }} --password-stdin
58-
59-
- name: Push tags to GitHub Container Registry
60-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
15+
- name: Set Vars
16+
id: outputs
6117
run: |
62-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
63-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
64-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
65-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
18+
echo "GITHUB_REPO=${{ env.GITHUB_REPO }}" >> $GITHUB_OUTPUT
19+
echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT
20+
echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT
21+
echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT
22+
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
23+
COMPOSE_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||')
24+
DOCKER_RELEASE=$(curl -sX GET "https://api.github.com/repos/moby/moby/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||')
25+
MOD_VERSION="${DOCKER_RELEASE}-${COMPOSE_RELEASE}"
26+
echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT
27+
outputs:
28+
GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }}
29+
ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }}
30+
BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }}
31+
MODNAME: ${{ steps.outputs.outputs.MODNAME }}
32+
MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }}
6633

67-
- name: Login to DockerHub
68-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
69-
run: |
70-
echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin
71-
72-
- name: Push tags to DockerHub
73-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
74-
run: |
75-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}
76-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.COMBINED_VERSION }}-${{ github.sha }}
77-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
78-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
34+
build:
35+
uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1
36+
needs: set-vars
37+
secrets:
38+
CR_USER: ${{ secrets.CR_USER }}
39+
CR_PAT: ${{ secrets.CR_PAT }}
40+
DOCKERUSER: ${{ secrets.DOCKERUSER }}
41+
DOCKERPASS: ${{ secrets.DOCKERPASS }}
42+
with:
43+
GITHUB_REPO: ${{ needs.set-vars.outputs.GITHUB_REPO }}
44+
ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }}
45+
BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }}
46+
MODNAME: ${{ needs.set-vars.outputs.MODNAME }}
47+
MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Issue & PR Tracker
2+
3+
on:
4+
issues:
5+
types: [opened,reopened,labeled,unlabeled,closed]
6+
pull_request_target:
7+
types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled,closed]
8+
pull_request_review:
9+
types: [submitted,edited,dismissed]
10+
11+
jobs:
12+
manage-project:
13+
permissions:
14+
issues: write
15+
uses: linuxserver/github-workflows/.github/workflows/issue-pr-tracker.yml@v1
16+
secrets: inherit

.github/workflows/permissions.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Permission check
2+
on:
3+
pull_request_target:
4+
paths:
5+
- '**/run'
6+
- '**/finish'
7+
- '**/check'
8+
jobs:
9+
permission_check:
10+
uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1

Dockerfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as buildstage
1+
# syntax=docker/dockerfile:1
22

3-
ARG DOCKER_RELEASE
4-
ARG COMPOSE_RELEASE
3+
FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage
4+
5+
ARG MOD_VERSION
56

67
RUN \
78
echo "**** install packages ****" && \
89
apk add --no-cache \
9-
curl \
1010
git \
1111
go && \
12-
echo "**** retrieve latest docker version ****" && \
13-
if [ -z ${DOCKER_RELEASE+x} ]; then \
12+
echo "**** retrieve latest version ****" && \
13+
if [[ -z "${MOD_VERSION+x}" ]]; then \
1414
DOCKER_RELEASE=$(curl -sX GET "https://api.github.com/repos/moby/moby/releases/latest" \
1515
| awk '/tag_name/{print $4;exit}' FS='[""]' \
1616
| sed 's|^v||'); \
17+
COMPOSE_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" \
18+
| awk '/tag_name/{print $4;exit}' FS='[""]' \
19+
| sed 's|^v||'); \
20+
else \
21+
DOCKER_RELEASE=$(echo "${MOD_VERSION}" | sed 's|-.*||'); \
22+
COMPOSE_RELEASE=$(echo "${MOD_VERSION}" | sed 's|.*-||'); \
1723
fi && \
1824
echo "**** grab docker ****" && \
1925
mkdir -p \
@@ -42,12 +48,6 @@ RUN \
4248
/tmp/docker_aarch64.tgz -C \
4349
/tmp/docker_aarch64 --strip-components=1 && \
4450
cp /tmp/docker_aarch64/docker /root-layer/docker-bins/docker_aarch64 && \
45-
echo "**** retrieve latest compose version ****" && \
46-
if [ -z ${COMPOSE_RELEASE+x} ]; then \
47-
COMPOSE_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" \
48-
| awk '/tag_name/{print $4;exit}' FS='[""]' \
49-
| sed 's|^v||'); \
50-
fi && \
5151
echo "**** grab compose ****" && \
5252
curl -fo \
5353
/root-layer/docker-bins/docker-compose_x86_64 -L \

root/etc/cont-init.d/95-docker

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)