From ca2c0ce48ee3a046b0b132d015aed836badf9ed6 Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 2 Feb 2020 15:54:30 -0500 Subject: [PATCH 01/26] create template branch --- .dockerignore | 6 ++ .gitattributes | 17 +++++ .gitignore | 43 +++++++++++++ .travis.yml | 25 +++++--- README.md | 166 ++++--------------------------------------------- blacklist.txt | 2 - 6 files changed, 95 insertions(+), 164 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitattributes create mode 100644 .gitignore delete mode 100644 blacklist.txt diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..cdb1a82fc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.gitignore +.github +.gitattributes +READMETEMPLATE.md +README.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..bdb0cabc8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..96374c4e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk diff --git a/.travis.yml b/.travis.yml index 388a81b2a..e6e5b1fb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,35 @@ -sudo: true +os: linux -language: bash +language: shell + +branches: + only: + - - #replace variables, omit brackets services: - docker env: global: - - DOCKERHUB="user/endpoint" + - DOCKERHUB="linuxserver/mods" #don't modify + - BASEIMAGE="baseimagename" #replace + - MODNAME="modname" #replace jobs: include: + - stage: PR-BuildImage + if: (type IN (pull_request)) + script: + # Build image + - docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} . - stage: BuildImage if: (NOT (type IN (pull_request))) script: # Build image - - docker build --no-cache -t ${DOCKERHUB}:${TRAVIS_COMMIT} . - - docker tag ${DOCKERHUB}:${TRAVIS_COMMIT} ${DOCKERHUB}:latest + - docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} . + - docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} # Login to DockerHub - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin # Push all of the tags - - docker push ${DOCKERHUB}:${TRAVIS_COMMIT} - - docker push ${DOCKERHUB}:latest + - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} + - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} \ No newline at end of file diff --git a/README.md b/README.md index 413c50059..867a00c1f 100644 --- a/README.md +++ b/README.md @@ -1,159 +1,15 @@ -# Intro +# Docker mod for openssh-server -The purpose of the repository is to provide examples and guidance in creating and storing a user consumable modification layer for the Library of Linuxserver.io Dockerhub Containers. -At it's core a Docker Mod is a tarball of files stored on Dockerhub that is downloaded and extracted on container boot before any init logic is run. -This allows: +This mod adds rsync to openssh-server, to be installed/updated during container start. -* Developers and community users to modify base containers to suit their needs without the need to maintain a fork of the main docker repository -* Mods to be shared with the Linuxserver.io userbase as individual independent projects with their own support channels and development ideologies -* Zero cost hosting and build pipelines for these modifications leveraging Github and Dockerhub -* Full custom configuration management layers for hooking containers into each other using environment variables contained in a compose file +In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync` -It is important to note to end users of this system that there are not only extreme security implications to consuming files from souces outside of our control, but by leveraging community Mods you essentially lose direct support from the core LinuxServer team. Our first and foremost troubleshooting step will be to remove the `DOCKER_MODS` environment variable when running into issues and replace the container with a clean LSIO one. +# Mod creation instructions -Again, when pulling in logic from external sources practice caution and trust the sources/community you get them from. - -## Using a Docker Mod - -Before consuming a Docker Mod ensure that the source code for it is publicly posted along with it's build pipeline pushing to Dockerhub. - -Consumption of a Docker Mod is intended to be as user friendly as possible and can be achieved with the following environment variables being passed to the container: - -* DOCKER_MODS- This can be a single endpoint `user/endpoint:tag` or an array of endpoints separated by `|` `user/endpoint:tag|user2/endpoint2:tag` -* RUN_BANNED_MODS- If this is set to any value you will bypass our centralized filter of banned Dockerhub users and run Mods regardless of a ban - -Full example: - -``` -docker create \ - --name=nzbget \ - -e DOCKER_MODS=taisun/nzbget-mod:latest \ - -e PUID=1000 \ - -e PGID=1000 \ - -e TZ=Europe/London \ - -p 6789:6789 \ - -v :/config \ - -v :/downloads \ - --restart unless-stopped \ - linuxserver/nzbget -``` - -This will spinup an nzbget container and apply the custom logic found in the following repository: - -https://github.com/Taisun-Docker/Linuxserver-Mod-Demo - -This basic demo installs Pip and a couple dependencies for plugins some users leverage with nzbget. - -## Creating and maintaining a Docker Mod - -We will always recommend to our users consuming Mods that they leverage ones from active community members or projects so transparency is key here. We understand that image layers can be pushed on the back end behind these pipelines, but every little bit helps. -In this repository we will be going over two basic methods of making a Mod along with an example of the Travis-CI.org build logic to get this into a Dockerhub endpoint. Though we are not officially endorsing Travis-CI here it is one of the most popular Open Source free build pipelines and only requires a Github account to get started. If you prefer others feel free to use them as long as build jobs are transparent. - -One of the core ideas to remember when creating a Mod is that it can only contain a single image layer, the examples below will show you how to add files standardly and how to run complex logic to assemble the files in a build layer to copy them over into this single layer. - -### Docker Mod Simple - just add scripts - -In this repository you will find the `Dockerfile` containing: - -``` -FROM scratch - -# copy local files -COPY root/ / -``` - -For most users this will suffice and anything in the root/ folder of the repository will be added to the end users Docker container / path. - -The most common paths to leverage for Linuxserver images will be: - -* root/etc/cont-init.d/<25-script-name> - Contains init logic scripts that run before the services in the container start these should exit 0 and are ordered by filename -* root/etc/services.d//run - Contains scripts that run in the foreground for persistent services IE NGINX -* root/defaults - Contains base config files that are copied/modified on first spinup - -The example files in this repo contain a script to install sshutil and a service file to run the installed utility. - -### Docker Mod Complex - Sky is the limit - -In this repository you will find the `Dockerfile.complex` containing: - -``` -## Buildstage ## -FROM lsiobase/alpine:3.9 as buildstage - -RUN \ - echo "**** install packages ****" && \ - apk add --no-cache \ - curl && \ - echo "**** grab rclone ****" && \ - mkdir -p /root-layer && \ - curl -o \ - /root-layer/rclone.deb -L \ - "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb" - -# copy local files -COPY root/ /root-layer/ - -## Single layer deployed image ## -FROM scratch - -# Add files from buildstage -COPY --from=buildstage /root-layer/ / -``` - -Here we are leveraging a multi stage DockerFile to run custom logic and pull down an Rclone deb from the Internet to include in our image layer for distribution. Any amount of logic can be run in this build stage or even multiple build stages as long as the files in the end are combined into a single folder for the COPY command in the final output. - -## Full loop - getting a Mod to Dockerhub - -First and foremost to publish a Mod you will need the following accounts: -* Github- https://github.com/join -* DockerHub- https://hub.docker.com/signup - -We reccomend using this repositroy as a template for your first Mod, so in this section we assume the code is finished and we will only concentrate on plugging into Travis/Dockerhub. - -The only code change you need to make to the build logic file `.travis.yml` will be to modify the DOCKERHUB endpoint to your own image: -``` -env: - global: - - DOCKERHUB="user/endpoint" -``` - -User is your Dockerhub user and endpoint is your own custom name. You do not need to create this endpoint beforehand, the build logic will push it and create it on first run. - -Head over to https://travis-ci.org/ and click on signup: - -![signup](https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/signup.png) - -This will use Github to auth you in. Once in the dashboard click on "Add new Repository": - -![addnew](https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/addnew.png) - -Click on settings for the repo you want to add: - -![settings](https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/settings.png) - -Under the "Environment Variables" section add DOCKERUSER and DOCKERPASS as shown below, these will be your live Dockerhub credentials: - -![env](https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/env.png) - -Once these are set click on the "Current" tab and "Activate repository": - -![activate](https://s3-us-west-2.amazonaws.com/linuxserver-docs/images/activate.png) - -Travis will trigger a build off of your repo and will push to Dockerhub on success. This Dockerhub endpoint is the Mod variable you can use to customize your container now. - - -## Appendix - -### Inspecting mods - -To inspect the file contents of external Mods dive is a great CLI tool: - -https://github.com/wagoodman/dive - -Basic usage: - -``` -docker run --rm -it \ - -v /var/run/docker.sock:/var/run/docker.sock \ - wagoodman/dive:latest -``` +* Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. +* Fork the repo, checkout the template branch. +* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. +* Inspect the `root` folder contents. Edit, add and remove as necessary. +* Edit this readme with pertinent info, delete thse instructions. +* Finally edit the `travis.yml`. Customize the build branch,and the vars for `BASEIMAGE` and `MODNAME` +* Submit PR against the branch created by the team \ No newline at end of file diff --git a/blacklist.txt b/blacklist.txt deleted file mode 100644 index 9cce7e51a..000000000 --- a/blacklist.txt +++ /dev/null @@ -1,2 +0,0 @@ -evilbitcoinminer -rootkitinc From 5be8b23ea105ad27c9cf986c4945ddef99ece6dd Mon Sep 17 00:00:00 2001 From: aptalca Date: Wed, 1 Apr 2020 17:35:56 -0400 Subject: [PATCH 02/26] readme and template updates --- README.md | 12 +++++++----- .../etc/cont-init.d/{99-vpn-config => 98-vpn-config} | 0 2 files changed, 7 insertions(+), 5 deletions(-) rename root/etc/cont-init.d/{99-vpn-config => 98-vpn-config} (100%) diff --git a/README.md b/README.md index 867a00c1f..2418e5307 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ -# Docker mod for openssh-server +# Rsync - Docker mod for openssh-server This mod adds rsync to openssh-server, to be installed/updated during container start. In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync` +If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-rsync|linuxserver/mods:openssh-server-mod2` + # Mod creation instructions * Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. -* Fork the repo, checkout the template branch. +* Fork the repo, checkout the newly created branch. * Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. * Inspect the `root` folder contents. Edit, add and remove as necessary. -* Edit this readme with pertinent info, delete thse instructions. -* Finally edit the `travis.yml`. Customize the build branch,and the vars for `BASEIMAGE` and `MODNAME` -* Submit PR against the branch created by the team \ No newline at end of file +* Edit this readme with pertinent info, delete these instructions. +* Finally edit the `travis.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. +* Submit PR against the branch created by the team. \ No newline at end of file diff --git a/root/etc/cont-init.d/99-vpn-config b/root/etc/cont-init.d/98-vpn-config similarity index 100% rename from root/etc/cont-init.d/99-vpn-config rename to root/etc/cont-init.d/98-vpn-config From 66c6ab5c69b64ed8f8065fb5e56588bf08b4ed80 Mon Sep 17 00:00:00 2001 From: aptalca Date: Fri, 2 Oct 2020 16:01:55 -0400 Subject: [PATCH 03/26] update mod creation instructions --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2418e5307..62f203fab 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE # Mod creation instructions -* Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. -* Fork the repo, checkout the newly created branch. +* Fork the repo, create a new branch based on the branch `template`. * Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. * Inspect the `root` folder contents. Edit, add and remove as necessary. * Edit this readme with pertinent info, delete these instructions. * Finally edit the `travis.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. -* Submit PR against the branch created by the team. \ No newline at end of file +* Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. +* Submit PR against the branch created by the team. From 69f8a2efb74154fd3b95205cb0ab26e9e8272cf3 Mon Sep 17 00:00:00 2001 From: aptalca Date: Fri, 2 Oct 2020 16:25:28 -0400 Subject: [PATCH 04/26] add maintainer label --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2f24b2092..4ece5e860 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ FROM scratch +LABEL maintainer="username" + # copy local files COPY root/ / From ca3be5789434030f34f21764344543ac934b38d9 Mon Sep 17 00:00:00 2001 From: aptalca Date: Thu, 15 Oct 2020 09:30:29 -0400 Subject: [PATCH 05/26] add maintainer to sample Dockerfile.complex --- Dockerfile.complex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.complex b/Dockerfile.complex index 4463d838a..bc9790250 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,5 +1,5 @@ ## Buildstage ## -FROM lsiobase/alpine:3.9 as buildstage +FROM lsiobase/alpine:3.12 as buildstage RUN \ echo "**** install packages ****" && \ @@ -17,5 +17,7 @@ COPY root/ /root-layer/ ## Single layer deployed image ## FROM scratch +LABEL maintainer="username" + # Add files from buildstage COPY --from=buildstage /root-layer/ / From afcc5a19aaa585681803520d850bce35473fc52b Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 24 Oct 2020 13:12:50 -0500 Subject: [PATCH 06/26] Replace Travis with GHA --- .github/workflows/BuildImage.yml | 30 +++++++++++++++++++++++++++ .travis.yml | 35 -------------------------------- README.md | 2 +- 3 files changed, 31 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/BuildImage.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml new file mode 100644 index 000000000..7758aa865 --- /dev/null +++ b/.github/workflows/BuildImage.yml @@ -0,0 +1,30 @@ +name: Build Image + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + env: + DOCKERHUB: "linuxserver/mods" #don't modify + BASEIMAGE: "baseimagename" #replace + MODNAME: "modname" #replace + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.3 + + - name: Build image + id: build + run: | + docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} . + + - name: Push image + if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }} + run: | + # Tag image + docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} + # Login to DockerHub + echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin + # Push all of the tags + docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} + docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e6e5b1fb6..000000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -os: linux - -language: shell - -branches: - only: - - - #replace variables, omit brackets - -services: - - docker - -env: - global: - - DOCKERHUB="linuxserver/mods" #don't modify - - BASEIMAGE="baseimagename" #replace - - MODNAME="modname" #replace - -jobs: - include: - - stage: PR-BuildImage - if: (type IN (pull_request)) - script: - # Build image - - docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} . - - stage: BuildImage - if: (NOT (type IN (pull_request))) - script: - # Build image - - docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} . - - docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} - # Login to DockerHub - - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin - # Push all of the tags - - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} - - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} \ No newline at end of file diff --git a/README.md b/README.md index 62f203fab..5636dec3e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,6 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE * Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. * Inspect the `root` folder contents. Edit, add and remove as necessary. * Edit this readme with pertinent info, delete these instructions. -* Finally edit the `travis.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. +* Finally edit the `.github/workflows/BuildImage.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. * Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. * Submit PR against the branch created by the team. From f20f64178f8e29ffcac0fdaf002627b3f4271b6a Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Mon, 2 Nov 2020 20:20:09 -0600 Subject: [PATCH 07/26] Add information about GHCR --- .github/workflows/BuildImage.yml | 60 ++++++++++++++++++++++++-------- Dockerfile.complex | 2 +- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 7758aa865..518b0d81d 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -2,29 +2,61 @@ name: Build Image on: [push, pull_request, workflow_dispatch] +env: + ENDPOINT: "linuxserver/mods" #don't modify + BASEIMAGE: "replace_baseimage" #replace + MODNAME: "replace_modname" #replace + jobs: build: - env: - DOCKERHUB: "linuxserver/mods" #don't modify - BASEIMAGE: "baseimagename" #replace - MODNAME: "modname" #replace - runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.3.3 - name: Build image - id: build run: | - docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} . + docker build --no-cache -t ${{ github.sha }} . - - name: Push image + - name: Tag image if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }} run: | - # Tag image - docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} - # Login to DockerHub + docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME} + docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} + docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME} + docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} + + - name: Credential check + if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }} + run: | + echo "CR_USER=${{ secrets.CR_USER }}" >> $GITHUB_ENV + echo "CR_PAT=${{ secrets.CR_PAT }}" >> $GITHUB_ENV + echo "DOCKERUSER=${{ secrets.DOCKERUSER }}" >> $GITHUB_ENV + echo "DOCKERPASS=${{ secrets.DOCKERPASS }}" >> $GITHUB_ENV + if [[ "${{ secrets.CR_USER }}" == "" && "${{ secrets.CR_PAT }}" == "" && "${{ secrets.DOCKERUSER }}" == "" && "${{ secrets.DOCKERPASS }}" == "" ]]; then + echo "::error::Push credential secrets missing." + echo "::error::You must set either CR_USER & CR_PAT or DOCKERUSER & DOCKERPASS as secrets in your repo settings." + echo "::error::See https://github.com/linuxserver/docker-mods/blob/master/README.md for more information/instructions." + exit 1 + fi + + - name: Login to GitHub Container Registry + if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }} + run: | + echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ secrets.CR_USER }} --password-stdin + + - name: Push tags to GitHub Container Registry + if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }} + run: | + docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} + docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME} + + - name: Login to DockerHub + if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }} + run: | echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin - # Push all of the tags - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} - docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME} + + - name: Push tags to DockerHub + if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }} + run: | + docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} + docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME} diff --git a/Dockerfile.complex b/Dockerfile.complex index bc9790250..8eb7e00d2 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,5 +1,5 @@ ## Buildstage ## -FROM lsiobase/alpine:3.12 as buildstage +FROM ghcr.io/linuxserver/baseimage-alpine::3.12 as buildstage RUN \ echo "**** install packages ****" && \ From 8a48ea51d8833349116871d6f796ad8f5d002824 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 3 Nov 2020 09:04:40 -0600 Subject: [PATCH 08/26] Update Dockerfile.complex --- Dockerfile.complex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.complex b/Dockerfile.complex index 8eb7e00d2..db4598e2c 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,5 +1,5 @@ ## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine::3.12 as buildstage +FROM ghcr.io/linuxserver/baseimage-alpine:3.12 as buildstage RUN \ echo "**** install packages ****" && \ From 413aa5129f288d53509235bf04f4c2a88c9fa95f Mon Sep 17 00:00:00 2001 From: Roxedus Date: Wed, 29 Dec 2021 23:25:33 +0100 Subject: [PATCH 09/26] Document internal "guidelines" --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 5636dec3e..761c79986 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,11 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE * Finally edit the `.github/workflows/BuildImage.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. * Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. * Submit PR against the branch created by the team. + + +## Tips and tricks + +* 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) +* Some images has helpers built in, these images are currently: + * [Openvscode-server](https://github.com/linuxserver/docker-openvscode-server/pull/10/files) + * [Code-server](https://github.com/linuxserver/docker-code-server/pull/95) From 28a244874b7d3fe9edd0e28a945feb9f7d772391 Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 25 Sep 2022 15:28:39 -0400 Subject: [PATCH 10/26] template update to s6 v2-v3 hybrid --- Dockerfile.complex | 18 +++++------ README.md | 2 ++ root/etc/cont-init.d/95-apt-get | 5 ++++ root/etc/cont-init.d/98-vpn-config | 1 - .../dependencies.d/init-mods | 0 .../run | 30 +++++++++++++++++++ .../type | 1 + .../init-mod-imagename-modname-add-package/up | 1 + .../dependencies.d/init-mods-package-install | 0 .../init-mod-imagename-modname-install/run | 8 +++++ .../init-mod-imagename-modname-install/type | 1 + .../init-mod-imagename-modname-install/up | 1 + .../init-mod-imagename-modname-install | 0 .../init-mod-imagename-modname-add-package | 0 .../dependencies.d/init-services | 0 .../s6-rc.d/svc-mod-imagename-modname/run | 7 +++++ .../s6-rc.d/svc-mod-imagename-modname/type | 1 + .../init-mod-imagename-modname-add-package | 0 .../init-mod-imagename-modname-install | 0 .../user/contents.d/svc-mod-imagename-modname | 0 root/etc/services.d/sshvpn/run | 0 21 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 root/etc/cont-init.d/95-apt-get create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/dependencies.d/init-mods create mode 100755 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/type create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/dependencies.d/init-mods-package-install create mode 100755 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-imagename-modname-install create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-imagename-modname-add-package create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/dependencies.d/init-services create mode 100755 root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-add-package create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-install create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mod-imagename-modname mode change 100644 => 100755 root/etc/services.d/sshvpn/run diff --git a/Dockerfile.complex b/Dockerfile.complex index db4598e2c..d2c6b11d4 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,15 +1,15 @@ ## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.12 as buildstage +FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as buildstage RUN \ - echo "**** install packages ****" && \ - apk add --no-cache \ - curl && \ - echo "**** grab rclone ****" && \ - mkdir -p /root-layer && \ - curl -o \ - /root-layer/rclone.deb -L \ - "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb" + echo "**** install packages ****" && \ + apk add --no-cache \ + curl && \ + echo "**** grab rclone ****" && \ + mkdir -p /root-layer && \ + curl -o \ + /root-layer/rclone.deb -L \ + "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb" # copy local files COPY root/ /root-layer/ diff --git a/README.md b/README.md index 761c79986..e2c84a558 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE * Fork the repo, create a new branch based on the branch `template`. * Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. * Inspect the `root` folder contents. Edit, add and remove as necessary. +* The mod should be compatible with both s6v2 and s6v3 (until s6v2 based baseimages are deprecated). +* After all init scripts and services are created, run `find ./ -name run -exec chmod +x {} +; find ./ -name finish -exec chmod +x {} +` to fix permissions. * Edit this readme with pertinent info, delete these instructions. * Finally edit the `.github/workflows/BuildImage.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. * Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. diff --git a/root/etc/cont-init.d/95-apt-get b/root/etc/cont-init.d/95-apt-get new file mode 100644 index 000000000..8e5fe6620 --- /dev/null +++ b/root/etc/cont-init.d/95-apt-get @@ -0,0 +1,5 @@ +#!/usr/bin/with-contenv bash + +if [ -f /usr/bin/apt ]; then + apt-get update +fi diff --git a/root/etc/cont-init.d/98-vpn-config b/root/etc/cont-init.d/98-vpn-config index a5f91276e..98f2770f2 100644 --- a/root/etc/cont-init.d/98-vpn-config +++ b/root/etc/cont-init.d/98-vpn-config @@ -4,7 +4,6 @@ if [ ! -f /usr/local/lib/python***/dist-packages/sshuttle ] && \ [ -f /usr/bin/apt ]; then ## Ubuntu - apt-get update apt-get install --no-install-recommends -y \ iptables \ openssh-client \ diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/dependencies.d/init-mods b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/dependencies.d/init-mods new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run new file mode 100755 index 000000000..063b57016 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run @@ -0,0 +1,30 @@ +#!/usr/bin/with-contenv bash + +# This is the init file used for adding os or pip packages to install lists. +# It takes advantage of the built-in init-mods-package-install init script that comes with the baseimages. +# If using this, we need to make sure we set this init as a dependency of init-mods-package-install so this one runs first + +if ! command -v apprise; then + echo "**** Adding apprise and its deps to package install lists ****" + echo "apprise" >> /mod-pip-packages-to-install.list + ## Ubuntu + if [ -f /usr/bin/apt ]; then + echo "\ + python3 \ + python3-pip \ + runc" >> /mod-repo-packages-to-install.list + fi + # Alpine + if [ -f /sbin/apk ]; then + echo "\ + cargo \ + libffi-dev \ + openssl-dev \ + python3 \ + python3-dev \ + python3 \ + py3-pip" >> /mod-repo-packages-to-install.list + fi +else + echo "**** apprise already installed, skipping ****" +fi diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/type b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/type new file mode 100644 index 000000000..3d92b15f2 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up new file mode 100644 index 000000000..6414139f8 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/dependencies.d/init-mods-package-install b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/dependencies.d/init-mods-package-install new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run new file mode 100755 index 000000000..59a4b77f1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run @@ -0,0 +1,8 @@ +#!/usr/bin/with-contenv bash + +# This is an install script that is designed to run after init-mods-package-install +# so it can take advantage of packages installed +# init-mods-end depends on this script so that later init and services wait until this script exits + +echo "**** Setting up apprise ****" +apprise blah blah diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type new file mode 100644 index 000000000..3d92b15f2 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up new file mode 100644 index 000000000..03d298d2b --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-imagename-modname-install b/root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-imagename-modname-install new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-imagename-modname-add-package b/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-imagename-modname-add-package new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/dependencies.d/init-services new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run new file mode 100755 index 000000000..02ffe39ae --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +# This is an example service that would run for the mod +# It depends on init-services, the baseimage hook for start of all longrun services + +exec \ + s6-setuidgid abc run my app diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type new file mode 100644 index 000000000..1780f9f44 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type @@ -0,0 +1 @@ +longrun \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-add-package b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-add-package new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-install b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-install new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mod-imagename-modname b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mod-imagename-modname new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/services.d/sshvpn/run b/root/etc/services.d/sshvpn/run old mode 100644 new mode 100755 From 6e7da79dd42b1d6f98cfefb6e42e270cafc47614 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 12 Dec 2022 12:27:03 -0500 Subject: [PATCH 11/26] add permission check workflow --- .github/workflows/permissions.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/permissions.yml diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml new file mode 100644 index 000000000..cfb610bb0 --- /dev/null +++ b/.github/workflows/permissions.yml @@ -0,0 +1,26 @@ +name: Permission check + +on: + pull_request: + paths: + - '**/run' + - '**/finish' + +jobs: + permission_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.1.0 + with: + fetch-depth: '0' + + - name: Check Permissions + run: | + WRONG_PERM=$(find ./ -name run -not -perm -u=x,g=x,o=x && find ./ -name finish -not -perm -u=x,g=x,o=x) + if [ -n "${WRONG_PERM}" ]; then + echo "**** The following files are missing the executable bit: ****" + echo "${WRONG_PERM}" + exit 1 + else + echo "**** All perms look good ****" + fi From 01070c583cf216a7402a82f895895071da5afc6a Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 12 Dec 2022 21:05:58 -0500 Subject: [PATCH 12/26] set proper workflow error message --- .github/workflows/permissions.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml index cfb610bb0..721c43f4e 100644 --- a/.github/workflows/permissions.yml +++ b/.github/workflows/permissions.yml @@ -18,8 +18,9 @@ jobs: run: | WRONG_PERM=$(find ./ -name run -not -perm -u=x,g=x,o=x && find ./ -name finish -not -perm -u=x,g=x,o=x) if [ -n "${WRONG_PERM}" ]; then - echo "**** The following files are missing the executable bit: ****" - echo "${WRONG_PERM}" + for i in ${WRONG_PERM}; do + echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!" + done exit 1 else echo "**** All perms look good ****" From 3e8f97648ffe600c16b39cd9723c1370c6126b92 Mon Sep 17 00:00:00 2001 From: aptalca Date: Tue, 13 Dec 2022 12:06:41 -0500 Subject: [PATCH 13/26] switch to callable --- .github/workflows/permissions.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml index 721c43f4e..2df6b61b8 100644 --- a/.github/workflows/permissions.yml +++ b/.github/workflows/permissions.yml @@ -1,27 +1,9 @@ name: Permission check - on: pull_request: paths: - '**/run' - '**/finish' - jobs: permission_check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.1.0 - with: - fetch-depth: '0' - - - name: Check Permissions - run: | - WRONG_PERM=$(find ./ -name run -not -perm -u=x,g=x,o=x && find ./ -name finish -not -perm -u=x,g=x,o=x) - if [ -n "${WRONG_PERM}" ]; then - for i in ${WRONG_PERM}; do - echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!" - done - exit 1 - else - echo "**** All perms look good ****" - fi + uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1 From 700f798471999e893925d479b65bc35b3c2d525f Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:36:33 -0400 Subject: [PATCH 14/26] update template switch to callable mod builder add issue-pr tracker workflow update permissions script update readme instructions --- .github/workflows/BuildImage.yml | 81 ++++++++------------- .github/workflows/call_issue_pr_tracker.yml | 14 ++++ .github/workflows/permissions.yml | 3 +- README.md | 7 +- 4 files changed, 51 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/call_issue_pr_tracker.yml diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 518b0d81d..39a64e9b6 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -1,62 +1,45 @@ name: Build Image -on: [push, pull_request, workflow_dispatch] +on: [push, pull_request_target, workflow_dispatch] env: + GITHUB_REPO: "linuxserver/docker-mods" #don't modify ENDPOINT: "linuxserver/mods" #don't modify BASEIMAGE: "replace_baseimage" #replace MODNAME: "replace_modname" #replace jobs: - build: + set-vars: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.3 - - - name: Build image - run: | - docker build --no-cache -t ${{ github.sha }} . - - - name: Tag image - if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }} - run: | - docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME} - docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} - docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME} - docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} - - - name: Credential check - if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }} - run: | - echo "CR_USER=${{ secrets.CR_USER }}" >> $GITHUB_ENV - echo "CR_PAT=${{ secrets.CR_PAT }}" >> $GITHUB_ENV - echo "DOCKERUSER=${{ secrets.DOCKERUSER }}" >> $GITHUB_ENV - echo "DOCKERPASS=${{ secrets.DOCKERPASS }}" >> $GITHUB_ENV - if [[ "${{ secrets.CR_USER }}" == "" && "${{ secrets.CR_PAT }}" == "" && "${{ secrets.DOCKERUSER }}" == "" && "${{ secrets.DOCKERPASS }}" == "" ]]; then - echo "::error::Push credential secrets missing." - echo "::error::You must set either CR_USER & CR_PAT or DOCKERUSER & DOCKERPASS as secrets in your repo settings." - echo "::error::See https://github.com/linuxserver/docker-mods/blob/master/README.md for more information/instructions." - exit 1 - fi - - - name: Login to GitHub Container Registry - if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }} - run: | - echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ secrets.CR_USER }} --password-stdin - - - name: Push tags to GitHub Container Registry - if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }} + - name: Set Vars + id: outputs run: | - docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} - docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME} + echo "GITHUB_REPO=${{ env.GITHUB_REPO }}" >> $GITHUB_OUTPUT + echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT + echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT + echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT + # **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. **** + MOD_VERSION="" + echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT + outputs: + GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }} + ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }} + BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }} + MODNAME: ${{ steps.outputs.outputs.MODNAME }} + MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }} - - name: Login to DockerHub - if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }} - run: | - echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin - - - name: Push tags to DockerHub - if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }} - run: | - docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }} - docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME} + build: + uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1 + needs: set-vars + secrets: + CR_USER: ${{ secrets.CR_USER }} + CR_PAT: ${{ secrets.CR_PAT }} + DOCKERUSER: ${{ secrets.DOCKERUSER }} + DOCKERPASS: ${{ secrets.DOCKERPASS }} + with: + GITHUB_REPO: ${{ needs.set-vars.outputs.GITHUB_REPO }} + ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }} + BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }} + MODNAME: ${{ needs.set-vars.outputs.MODNAME }} + MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }} diff --git a/.github/workflows/call_issue_pr_tracker.yml b/.github/workflows/call_issue_pr_tracker.yml new file mode 100644 index 000000000..87243e2c4 --- /dev/null +++ b/.github/workflows/call_issue_pr_tracker.yml @@ -0,0 +1,14 @@ +name: Issue & PR Tracker + +on: + issues: + types: [opened,reopened,labeled,unlabeled] + pull_request_target: + types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled] + +jobs: + manage-project: + permissions: + issues: write + uses: linuxserver/github-workflows/.github/workflows/issue-pr-tracker.yml@v1 + secrets: inherit diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml index 2df6b61b8..1447bc55a 100644 --- a/.github/workflows/permissions.yml +++ b/.github/workflows/permissions.yml @@ -1,9 +1,10 @@ name: Permission check on: - pull_request: + pull_request_target: paths: - '**/run' - '**/finish' + - '**/check' jobs: permission_check: uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1 diff --git a/README.md b/README.md index e2c84a558..1dfa01bab 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,15 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE * Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. * Inspect the `root` folder contents. Edit, add and remove as necessary. * The mod should be compatible with both s6v2 and s6v3 (until s6v2 based baseimages are deprecated). -* After all init scripts and services are created, run `find ./ -name run -exec chmod +x {} +; find ./ -name finish -exec chmod +x {} +` to fix permissions. +* After all init scripts and services are created, run `find ./ -path "./.git" -prune -o \( -name "run" -o -name "service" -o -name "check" \) -not -perm -u=x,g=x,o=x -print -exec chmod +x {} +` to fix permissions. * Edit this readme with pertinent info, delete these instructions. -* Finally edit the `.github/workflows/BuildImage.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`. +* Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic if needed. * Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. * Submit PR against the branch created by the team. ## Tips and tricks -* 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) -* Some images has helpers built in, these images are currently: +* Some images have helpers built in, these images are currently: * [Openvscode-server](https://github.com/linuxserver/docker-openvscode-server/pull/10/files) * [Code-server](https://github.com/linuxserver/docker-code-server/pull/95) From 880cc9b0d42437d84a6b9020ec1e9c40d8432155 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:59:46 -0400 Subject: [PATCH 15/26] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1dfa01bab..a87829824 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE * Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. * Inspect the `root` folder contents. Edit, add and remove as necessary. * The mod should be compatible with both s6v2 and s6v3 (until s6v2 based baseimages are deprecated). -* After all init scripts and services are created, run `find ./ -path "./.git" -prune -o \( -name "run" -o -name "service" -o -name "check" \) -not -perm -u=x,g=x,o=x -print -exec chmod +x {} +` to fix permissions. +* 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. * Edit this readme with pertinent info, delete these instructions. * Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic if needed. * Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. From 65dbb2c261235570a6ea3a54272d8c3f0401795d Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:37:22 -0400 Subject: [PATCH 16/26] remove s6v2 compatibility --- README.md | 1 - root/etc/cont-init.d/95-apt-get | 5 ----- root/etc/cont-init.d/98-vpn-config | 26 -------------------------- root/etc/services.d/sshvpn/run | 3 --- 4 files changed, 35 deletions(-) delete mode 100644 root/etc/cont-init.d/95-apt-get delete mode 100644 root/etc/cont-init.d/98-vpn-config delete mode 100755 root/etc/services.d/sshvpn/run diff --git a/README.md b/README.md index a87829824..c8bfc60a9 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE * Fork the repo, create a new branch based on the branch `template`. * Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done. * Inspect the `root` folder contents. Edit, add and remove as necessary. -* The mod should be compatible with both s6v2 and s6v3 (until s6v2 based baseimages are deprecated). * 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. * Edit this readme with pertinent info, delete these instructions. * Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic if needed. diff --git a/root/etc/cont-init.d/95-apt-get b/root/etc/cont-init.d/95-apt-get deleted file mode 100644 index 8e5fe6620..000000000 --- a/root/etc/cont-init.d/95-apt-get +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -if [ -f /usr/bin/apt ]; then - apt-get update -fi diff --git a/root/etc/cont-init.d/98-vpn-config b/root/etc/cont-init.d/98-vpn-config deleted file mode 100644 index 98f2770f2..000000000 --- a/root/etc/cont-init.d/98-vpn-config +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/with-contenv bash - -# Determine if setup is needed -if [ ! -f /usr/local/lib/python***/dist-packages/sshuttle ] && \ -[ -f /usr/bin/apt ]; then - ## Ubuntu - apt-get install --no-install-recommends -y \ - iptables \ - openssh-client \ - python3 \ - python3-pip - pip3 install sshuttle -fi -if [ ! -f /usr/lib/python***/site-packages/sshuttle ] && \ -[ -f /sbin/apk ]; then - # Alpine - apk add --no-cache \ - iptables \ - openssh \ - py3-pip \ - python3 - pip3 install sshuttle -fi - -chown -R root:root /root -chmod -R 600 /root/.ssh diff --git a/root/etc/services.d/sshvpn/run b/root/etc/services.d/sshvpn/run deleted file mode 100755 index 7d49e7969..000000000 --- a/root/etc/services.d/sshvpn/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/with-contenv bash - -sshuttle --dns --remote root@${HOST}:${PORT} 0/0 -x 172.17.0.0/16 From b05c951c02963097dca73d0b1904681b1eae5bfd Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Thu, 13 Apr 2023 15:40:48 -0400 Subject: [PATCH 17/26] add dockerfile syntax --- Dockerfile | 2 ++ Dockerfile.complex | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4ece5e860..aa6617046 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# syntax=docker/dockerfile:1 + FROM scratch LABEL maintainer="username" diff --git a/Dockerfile.complex b/Dockerfile.complex index d2c6b11d4..c0b5cf72b 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,5 +1,7 @@ +# syntax=docker/dockerfile:1 + ## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as buildstage +FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage RUN \ echo "**** install packages ****" && \ From cc80a43d42638052e9298c36191555408fecb1b1 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 14 Apr 2023 16:33:19 -0400 Subject: [PATCH 18/26] handle issue-pr close and review submitted actions --- .github/workflows/call_issue_pr_tracker.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/call_issue_pr_tracker.yml b/.github/workflows/call_issue_pr_tracker.yml index 87243e2c4..2c3078434 100644 --- a/.github/workflows/call_issue_pr_tracker.yml +++ b/.github/workflows/call_issue_pr_tracker.yml @@ -2,9 +2,11 @@ name: Issue & PR Tracker on: issues: - types: [opened,reopened,labeled,unlabeled] + types: [opened,reopened,labeled,unlabeled,closed] pull_request_target: - types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled] + types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled,closed] + pull_request_review: + types: [submitted,edited,dismissed] jobs: manage-project: From 00d5edca06c67177362aec91a4c0439f8c05a388 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:20:05 -0500 Subject: [PATCH 19/26] add multi-arch support to template --- .github/workflows/BuildImage.yml | 4 ++++ Dockerfile.complex | 16 ++++++++++++---- README.md | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 39a64e9b6..8213c2f03 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -7,6 +7,7 @@ env: ENDPOINT: "linuxserver/mods" #don't modify BASEIMAGE: "replace_baseimage" #replace MODNAME: "replace_modname" #replace + MULTI_ARCH: "false" #set to true if needed jobs: set-vars: @@ -19,6 +20,7 @@ jobs: echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT + echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT # **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. **** MOD_VERSION="" echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT @@ -27,6 +29,7 @@ jobs: ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }} BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }} MODNAME: ${{ steps.outputs.outputs.MODNAME }} + MULTI_ARCH: ${{ steps.outputs.outputs.MULTI_ARCH }} MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }} build: @@ -42,4 +45,5 @@ jobs: ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }} BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }} MODNAME: ${{ needs.set-vars.outputs.MODNAME }} + MULTI_ARCH: ${{ needs.set-vars.outputs.MULTI_ARCH }} MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }} diff --git a/Dockerfile.complex b/Dockerfile.complex index c0b5cf72b..e7a234d2d 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage +FROM ghcr.io/linuxserver/baseimage-alpine:3.19 as buildstage RUN \ echo "**** install packages ****" && \ @@ -9,9 +9,17 @@ RUN \ curl && \ echo "**** grab rclone ****" && \ mkdir -p /root-layer && \ - curl -o \ - /root-layer/rclone.deb -L \ - "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb" + if [[ $(uname -m) == "x86_64" ]]; then \ + echo "Downloading x86_64 tarball" && \ + curl -o \ + /root-layer/rclone.deb -L \ + "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb"; \ + elif [[ $(uname -m) == "aarch64" ]]; then \ + echo "Downloading aarch64 tarball" && \ + curl -o \ + /root-layer/rclone.deb -L \ + "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-arm64.deb"; \ + fi && \ # copy local files COPY root/ /root-layer/ diff --git a/README.md b/README.md index c8bfc60a9..170066831 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ If adding multiple mods, enter them in an array separated by `|`, such as `DOCKE * Inspect the `root` folder contents. Edit, add and remove as necessary. * 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. * Edit this readme with pertinent info, delete these instructions. -* Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic if needed. +* Finally edit the `.github/workflows/BuildImage.yml`. Customize the vars for `BASEIMAGE` and `MODNAME`. Set the versioning logic and `MULTI_ARCH` if needed. * Ask the team to create a new branch named `-`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch. * Submit PR against the branch created by the team. From c3f81ed55abd76c824b61de90eb0833f3d8af5cb Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:09:55 -0500 Subject: [PATCH 20/26] use sh syntax --- Dockerfile.complex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.complex b/Dockerfile.complex index e7a234d2d..eb80898f6 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -9,12 +9,12 @@ RUN \ curl && \ echo "**** grab rclone ****" && \ mkdir -p /root-layer && \ - if [[ $(uname -m) == "x86_64" ]]; then \ + if [ $(uname -m) = "x86_64" ]; then \ echo "Downloading x86_64 tarball" && \ curl -o \ /root-layer/rclone.deb -L \ "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb"; \ - elif [[ $(uname -m) == "aarch64" ]]; then \ + elif [ $(uname -m) = "aarch64" ]; then \ echo "Downloading aarch64 tarball" && \ curl -o \ /root-layer/rclone.deb -L \ From e0970214f26f80601468406d8e1869b5e66cae99 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:56:47 -0500 Subject: [PATCH 21/26] Default MULTI_ARCH to true --- .github/workflows/BuildImage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 8213c2f03..6008e8509 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -7,7 +7,7 @@ env: ENDPOINT: "linuxserver/mods" #don't modify BASEIMAGE: "replace_baseimage" #replace MODNAME: "replace_modname" #replace - MULTI_ARCH: "false" #set to true if needed + MULTI_ARCH: "true" #set to false if not needed jobs: set-vars: From d799cab18c7321566000cb8fc6f501ab6b084881 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:37:20 -0400 Subject: [PATCH 22/26] fix casing to suppress docker build warning --- Dockerfile.complex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.complex b/Dockerfile.complex index eb80898f6..61a302718 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.19 as buildstage +FROM ghcr.io/linuxserver/baseimage-alpine:3.19 AS buildstage RUN \ echo "**** install packages ****" && \ From 1271254e6c5c6c79e6febf218b355ba1a5578bb7 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:38:10 -0400 Subject: [PATCH 23/26] update alpine version in example Dockerfile --- Dockerfile.complex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.complex b/Dockerfile.complex index 61a302718..3ed07b0dc 100644 --- a/Dockerfile.complex +++ b/Dockerfile.complex @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.19 AS buildstage +FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage RUN \ echo "**** install packages ****" && \ From e3e0998095ba5edc30bb2ac4638f2372646ed721 Mon Sep 17 00:00:00 2001 From: thespad Date: Wed, 11 Sep 2024 17:28:43 +0100 Subject: [PATCH 24/26] Add v2 sample workflow --- .github/workflows/BuildImage.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 6008e8509..360333f01 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -1,12 +1,20 @@ name: Build Image -on: [push, pull_request_target, workflow_dispatch] +on: + push: + pull_request_target: + workflow_dispatch: + inputs: + mod_version: + type: string + required: false env: GITHUB_REPO: "linuxserver/docker-mods" #don't modify ENDPOINT: "linuxserver/mods" #don't modify BASEIMAGE: "replace_baseimage" #replace MODNAME: "replace_modname" #replace + MOD_VERSION: ${{ inputs.mod_version }} #don't modify MULTI_ARCH: "true" #set to false if not needed jobs: @@ -21,8 +29,13 @@ jobs: echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT - # **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. **** - MOD_VERSION="" + if [[ -z "${{ env.MOD_VERSION }}" ]]; then + # **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. **** + MOD_VERSION="" + else + MOD_VERSION=${{ env.MOD_VERSION }} + echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT + fi echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT outputs: GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }} @@ -31,9 +44,10 @@ jobs: MODNAME: ${{ steps.outputs.outputs.MODNAME }} MULTI_ARCH: ${{ steps.outputs.outputs.MULTI_ARCH }} MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }} + MOD_VERSION_OVERRIDE: ${{ steps.outputs.outputs.MOD_VERSION_OVERRIDE }} build: - uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1 + uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v2 needs: set-vars secrets: CR_USER: ${{ secrets.CR_USER }} @@ -47,3 +61,4 @@ jobs: MODNAME: ${{ needs.set-vars.outputs.MODNAME }} MULTI_ARCH: ${{ needs.set-vars.outputs.MULTI_ARCH }} MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }} + MOD_VERSION_OVERRIDE: ${{ needs.set-vars.outputs.MOD_VERSION_OVERRIDE }} From 71ed9ae65ee8681e77bcd5debebc404534359c80 Mon Sep 17 00:00:00 2001 From: thespad Date: Wed, 11 Sep 2024 19:25:59 +0100 Subject: [PATCH 25/26] Update workflow version --- .github/workflows/BuildImage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 360333f01..4715e563b 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -47,7 +47,7 @@ jobs: MOD_VERSION_OVERRIDE: ${{ steps.outputs.outputs.MOD_VERSION_OVERRIDE }} build: - uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v2 + uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1 needs: set-vars secrets: CR_USER: ${{ secrets.CR_USER }} From b77d4b0d65e30f69b6b485f7d498d88ac84aa19a Mon Sep 17 00:00:00 2001 From: Mildman1848 Date: Tue, 22 Jul 2025 16:28:39 +0200 Subject: [PATCH 26/26] Initial --- .github/workflows/BuildImage.yml | 12 +++---- Dockerfile | 2 +- Dockerfile.complex | 33 ------------------- .../run | 30 ----------------- .../init-mod-imagename-modname-add-package/up | 1 - .../init-mod-imagename-modname-install/run | 8 ----- .../init-mod-imagename-modname-install/type | 1 - .../init-mod-imagename-modname-install/up | 1 - .../dependencies.d/init-mods | 0 .../run | 12 +++++++ .../type | 0 .../up | 1 + .../init-mod-imagename-modname-add-package | 0 ...t-mod-universal-infisical-cli-add-package} | 0 .../dependencies.d/init-services | 0 .../s6-rc.d/svc-mod-imagename-modname/run | 7 ---- .../s6-rc.d/svc-mod-imagename-modname/type | 1 - .../init-mod-imagename-modname-add-package | 0 .../init-mod-imagename-modname-install | 0 ...t-mod-universal-infisical-cli-add-package} | 0 .../user/contents.d/svc-mod-imagename-modname | 0 21 files changed, 19 insertions(+), 90 deletions(-) delete mode 100644 Dockerfile.complex delete mode 100755 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up delete mode 100755 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up rename root/etc/s6-overlay/s6-rc.d/{init-mod-imagename-modname-add-package => init-mod-universal-infisical-cli-add-package}/dependencies.d/init-mods (100%) create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/run rename root/etc/s6-overlay/s6-rc.d/{init-mod-imagename-modname-add-package => init-mod-universal-infisical-cli-add-package}/type (100%) create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/up delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-imagename-modname-add-package rename root/etc/s6-overlay/s6-rc.d/{init-mod-imagename-modname-install/dependencies.d/init-mods-package-install => init-mods-package-install/dependencies.d/init-mod-universal-infisical-cli-add-package} (100%) delete mode 100644 root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/dependencies.d/init-services delete mode 100755 root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type delete mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-add-package delete mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-install rename root/etc/s6-overlay/s6-rc.d/{init-mods-end/dependencies.d/init-mod-imagename-modname-install => user/contents.d/init-mod-universal-infisical-cli-add-package} (100%) delete mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mod-imagename-modname diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 4715e563b..59b006c8c 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -10,10 +10,10 @@ on: required: false env: - GITHUB_REPO: "linuxserver/docker-mods" #don't modify - ENDPOINT: "linuxserver/mods" #don't modify - BASEIMAGE: "replace_baseimage" #replace - MODNAME: "replace_modname" #replace + GITHUB_REPO: "mildman1848/docker-mods" #don't modify + ENDPOINT: "mildman1848/mods" #don't modify + BASEIMAGE: "universal" #replace + MODNAME: "infisical-cli" #replace MOD_VERSION: ${{ inputs.mod_version }} #don't modify MULTI_ARCH: "true" #set to false if not needed @@ -47,11 +47,9 @@ jobs: MOD_VERSION_OVERRIDE: ${{ steps.outputs.outputs.MOD_VERSION_OVERRIDE }} build: - uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1 + uses: mildman1848/github-workflows/.github/workflows/docker-mod-builder.yml@v1 needs: set-vars secrets: - CR_USER: ${{ secrets.CR_USER }} - CR_PAT: ${{ secrets.CR_PAT }} DOCKERUSER: ${{ secrets.DOCKERUSER }} DOCKERPASS: ${{ secrets.DOCKERPASS }} with: diff --git a/Dockerfile b/Dockerfile index aa6617046..5457f4353 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM scratch -LABEL maintainer="username" +LABEL maintainer="mildman1848" # copy local files COPY root/ / diff --git a/Dockerfile.complex b/Dockerfile.complex deleted file mode 100644 index 3ed07b0dc..000000000 --- a/Dockerfile.complex +++ /dev/null @@ -1,33 +0,0 @@ -# syntax=docker/dockerfile:1 - -## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage - -RUN \ - echo "**** install packages ****" && \ - apk add --no-cache \ - curl && \ - echo "**** grab rclone ****" && \ - mkdir -p /root-layer && \ - if [ $(uname -m) = "x86_64" ]; then \ - echo "Downloading x86_64 tarball" && \ - curl -o \ - /root-layer/rclone.deb -L \ - "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb"; \ - elif [ $(uname -m) = "aarch64" ]; then \ - echo "Downloading aarch64 tarball" && \ - curl -o \ - /root-layer/rclone.deb -L \ - "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-arm64.deb"; \ - fi && \ - -# copy local files -COPY root/ /root-layer/ - -## Single layer deployed image ## -FROM scratch - -LABEL maintainer="username" - -# Add files from buildstage -COPY --from=buildstage /root-layer/ / diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run deleted file mode 100755 index 063b57016..000000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/with-contenv bash - -# This is the init file used for adding os or pip packages to install lists. -# It takes advantage of the built-in init-mods-package-install init script that comes with the baseimages. -# If using this, we need to make sure we set this init as a dependency of init-mods-package-install so this one runs first - -if ! command -v apprise; then - echo "**** Adding apprise and its deps to package install lists ****" - echo "apprise" >> /mod-pip-packages-to-install.list - ## Ubuntu - if [ -f /usr/bin/apt ]; then - echo "\ - python3 \ - python3-pip \ - runc" >> /mod-repo-packages-to-install.list - fi - # Alpine - if [ -f /sbin/apk ]; then - echo "\ - cargo \ - libffi-dev \ - openssl-dev \ - python3 \ - python3-dev \ - python3 \ - py3-pip" >> /mod-repo-packages-to-install.list - fi -else - echo "**** apprise already installed, skipping ****" -fi diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up deleted file mode 100644 index 6414139f8..000000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/up +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run deleted file mode 100755 index 59a4b77f1..000000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/with-contenv bash - -# This is an install script that is designed to run after init-mods-package-install -# so it can take advantage of packages installed -# init-mods-end depends on this script so that later init and services wait until this script exits - -echo "**** Setting up apprise ****" -apprise blah blah diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type deleted file mode 100644 index 3d92b15f2..000000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/type +++ /dev/null @@ -1 +0,0 @@ -oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up b/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up deleted file mode 100644 index 03d298d2b..000000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/up +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/dependencies.d/init-mods b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/dependencies.d/init-mods similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/dependencies.d/init-mods rename to root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/dependencies.d/init-mods diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/run b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/run new file mode 100644 index 000000000..53c98830c --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/run @@ -0,0 +1,12 @@ +#!/bin/with-contenv bash + +# Installing dependencies and Infisical CLI +apk add --no-cache bash curl +curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.alpine.sh' | bash +apk update && apk add infisical=0.41.94 + +# Ensure Infisical CLI is executable +chmod +x /usr/bin/infisical + +# Clean up to minimize image size +rm -rf /var/cache/apk/* /tmp/* \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/type b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/type similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-add-package/type rename to root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/type diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/up b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/up new file mode 100644 index 000000000..6dfc8545c --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-mod-universal-infisical-cli-add-package/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-imagename-modname-add-package b/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-imagename-modname-add-package deleted file mode 100644 index e69de29bb..000000000 diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/dependencies.d/init-mods-package-install b/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-universal-infisical-cli-add-package similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-mod-imagename-modname-install/dependencies.d/init-mods-package-install rename to root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-universal-infisical-cli-add-package diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/dependencies.d/init-services deleted file mode 100644 index e69de29bb..000000000 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run deleted file mode 100755 index 02ffe39ae..000000000 --- a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/run +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/with-contenv bash - -# This is an example service that would run for the mod -# It depends on init-services, the baseimage hook for start of all longrun services - -exec \ - s6-setuidgid abc run my app diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type b/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type deleted file mode 100644 index 1780f9f44..000000000 --- a/root/etc/s6-overlay/s6-rc.d/svc-mod-imagename-modname/type +++ /dev/null @@ -1 +0,0 @@ -longrun \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-add-package b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-add-package deleted file mode 100644 index e69de29bb..000000000 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-install b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-imagename-modname-install deleted file mode 100644 index e69de29bb..000000000 diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-imagename-modname-install b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-universal-infisical-cli-add-package similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-imagename-modname-install rename to root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-universal-infisical-cli-add-package diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mod-imagename-modname b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mod-imagename-modname deleted file mode 100644 index e69de29bb..000000000