Skip to content

Commit d19b988

Browse files
authored
Merge pull request #621 from linuxserver/template-update
update template
2 parents 6745950 + 880cc9b commit d19b988

File tree

4 files changed

+51
-54
lines changed

4 files changed

+51
-54
lines changed

.github/workflows/BuildImage.yml

Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,45 @@
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: "replace_baseimage" #replace
89
MODNAME: "replace_modname" #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-
docker build --no-cache -t ${{ github.sha }} .
19-
20-
- name: Tag image
21-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
22-
run: |
23-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
24-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
25-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
26-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
27-
28-
- name: Credential check
29-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
30-
run: |
31-
echo "CR_USER=${{ secrets.CR_USER }}" >> $GITHUB_ENV
32-
echo "CR_PAT=${{ secrets.CR_PAT }}" >> $GITHUB_ENV
33-
echo "DOCKERUSER=${{ secrets.DOCKERUSER }}" >> $GITHUB_ENV
34-
echo "DOCKERPASS=${{ secrets.DOCKERPASS }}" >> $GITHUB_ENV
35-
if [[ "${{ secrets.CR_USER }}" == "" && "${{ secrets.CR_PAT }}" == "" && "${{ secrets.DOCKERUSER }}" == "" && "${{ secrets.DOCKERPASS }}" == "" ]]; then
36-
echo "::error::Push credential secrets missing."
37-
echo "::error::You must set either CR_USER & CR_PAT or DOCKERUSER & DOCKERPASS as secrets in your repo settings."
38-
echo "::error::See https://github.com/linuxserver/docker-mods/blob/master/README.md for more information/instructions."
39-
exit 1
40-
fi
41-
42-
- name: Login to GitHub Container Registry
43-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
44-
run: |
45-
echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ secrets.CR_USER }} --password-stdin
46-
47-
- name: Push tags to GitHub Container Registry
48-
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
4917
run: |
50-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
51-
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+
MOD_VERSION=""
24+
echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT
25+
outputs:
26+
GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }}
27+
ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }}
28+
BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }}
29+
MODNAME: ${{ steps.outputs.outputs.MODNAME }}
30+
MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }}
5231

53-
- name: Login to DockerHub
54-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
55-
run: |
56-
echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin
57-
58-
- name: Push tags to DockerHub
59-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
60-
run: |
61-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
62-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
32+
build:
33+
uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1
34+
needs: set-vars
35+
secrets:
36+
CR_USER: ${{ secrets.CR_USER }}
37+
CR_PAT: ${{ secrets.CR_PAT }}
38+
DOCKERUSER: ${{ secrets.DOCKERUSER }}
39+
DOCKERPASS: ${{ secrets.DOCKERPASS }}
40+
with:
41+
GITHUB_REPO: ${{ needs.set-vars.outputs.GITHUB_REPO }}
42+
ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }}
43+
BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }}
44+
MODNAME: ${{ needs.set-vars.outputs.MODNAME }}
45+
MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Issue & PR Tracker
2+
3+
on:
4+
issues:
5+
types: [opened,reopened,labeled,unlabeled]
6+
pull_request_target:
7+
types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled]
8+
9+
jobs:
10+
manage-project:
11+
permissions:
12+
issues: write
13+
uses: linuxserver/github-workflows/.github/workflows/issue-pr-tracker.yml@v1
14+
secrets: inherit

.github/workflows/permissions.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: Permission check
22
on:
3-
pull_request:
3+
pull_request_target:
44
paths:
55
- '**/run'
66
- '**/finish'
7+
- '**/check'
78
jobs:
89
permission_check:
910
uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE
1212
* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done.
1313
* Inspect the `root` folder contents. Edit, add and remove as necessary.
1414
* The mod should be compatible with both s6v2 and s6v3 (until s6v2 based baseimages are deprecated).
15-
* After all init scripts and services are created, run `find ./ -name run -exec chmod +x {} +; find ./ -name finish -exec chmod +x {} +` to fix permissions.
15+
* After all init scripts and services are created, run `find ./ -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print -exec chmod +x {} +` to fix permissions.
1616
* Edit this readme with pertinent info, delete these instructions.
17-
* Finally edit the `.github/workflows/BuildImage.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`.
17+
* Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic if needed.
1818
* Ask the team to create a new branch named `<baseimagename>-<modname>`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch.
1919
* Submit PR against the branch created by the team.
2020

2121

2222
## Tips and tricks
2323

24-
* To decrease startup times when multiple mods are used, we have consolidated `apt-get update` down to one file. As seen in the [nodejs mod](https://github.com/linuxserver/docker-mods/tree/code-server-nodejs/root/etc/cont-init.d)
25-
* Some images has helpers built in, these images are currently:
24+
* Some images have helpers built in, these images are currently:
2625
* [Openvscode-server](https://github.com/linuxserver/docker-openvscode-server/pull/10/files)
2726
* [Code-server](https://github.com/linuxserver/docker-code-server/pull/95)

0 commit comments

Comments
 (0)