From b9e83b34062a4e1f7efa27f0f59756c4a3f103e6 Mon Sep 17 00:00:00 2001 From: Alexander Schomburg Date: Sun, 14 Nov 2021 22:08:44 +0100 Subject: [PATCH 1/6] Added translations to ProjectSend docker image --- .github/workflows/BuildImage.yml | 14 +++------- Dockerfile | 6 ++++- Dockerfile.complex | 23 ---------------- README.md | 43 +++++++++++++++++++++--------- root/etc/cont-init.d/98-vpn-config | 27 ------------------- root/etc/services.d/sshvpn/run | 3 --- root/install-translations.sh | 16 +++++++++++ 7 files changed, 56 insertions(+), 76 deletions(-) delete mode 100644 Dockerfile.complex delete mode 100644 root/etc/cont-init.d/98-vpn-config delete mode 100644 root/etc/services.d/sshvpn/run create mode 100644 root/install-translations.sh diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 518b0d8..f70ee9d 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -3,9 +3,9 @@ name: Build Image on: [push, pull_request, workflow_dispatch] env: - ENDPOINT: "linuxserver/mods" #don't modify - BASEIMAGE: "replace_baseimage" #replace - MODNAME: "replace_modname" #replace + ENDPOINT: "linuxserver/mods" + BASEIMAGE: "projectsend" + MODNAME: "translations" jobs: build: @@ -16,7 +16,6 @@ jobs: - 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: | @@ -24,7 +23,6 @@ jobs: 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: | @@ -38,25 +36,21 @@ jobs: 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 - - 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} + docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4ece5e8..2b26acd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ FROM scratch -LABEL maintainer="username" +LABEL maintainer="alexschomb" # copy local files COPY root/ / + +# install languages +RUN chmod +x /install-translations.sh +CMD /install-translations.sh \ No newline at end of file diff --git a/Dockerfile.complex b/Dockerfile.complex deleted file mode 100644 index db4598e..0000000 --- a/Dockerfile.complex +++ /dev/null @@ -1,23 +0,0 @@ -## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.12 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 - -LABEL maintainer="username" - -# Add files from buildstage -COPY --from=buildstage /root-layer/ / diff --git a/README.md b/README.md index 5636dec..fe67db7 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,36 @@ -# Rsync - Docker mod for openssh-server +# Translations - Docker mod for projectsend -This mod adds rsync to openssh-server, to be installed/updated during container start. +This mod adds installation options for adding translations to the [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend) for [ProjectSend](http://www.projectsend.org/). The translations to be installed can be defined with ``PS_INSTALL_TRANSLATIONS`` as a comma-separated list and will be automatically downloaded from the [official translations website](https://www.projectsend.org/translations/). To help translating (and adding your preferred language to) ProjectSend, please follow [this link](https://www.transifex.com/subwaydesign/projectsend/). -In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync` +## Using this Docker Mod -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` +To add this Docker Mod to your installation of the ProjectSend [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend), please add this endpoint ``linuxserver/mods:projectsend-translations`` to the ``DOCKER_MODS`` environment variable. You can install multiple Docker Mods by separating them by ``|``. [Read this page](https://github.com/linuxserver/docker-mods#using-a-docker-mod) for more information. -# Mod creation instructions +Now, you can define the languages/translations to be installed with their "Lang. code" value from the before mentioned [official translations website](https://www.projectsend.org/translations/) to the ``TRANSLATIONS`` environment variable. You can choose to install multiple translations by separating them with commas. The English translation ``en`` is automatically installed by the ProjectSend image and does not have to be addressed by this Docker Mod or the ``TRANSLATIONS`` environment variable. -* 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 `.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. +Full example with ``docker-compose``: + +``` +--- +version: "2.1" +services: + projectsend: + image: lscr.io/linuxserver/projectsend + container_name: projectsend + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/London + - MAX_UPLOAD=<5000> + - DOCKER_MODS=linuxserver/mods:projectsend-translations + - TRANSLATIONS=de,fr,zh_CN + volumes: + - :/config + - :/data + ports: + - 80:80 + restart: unless-stopped +``` + +## Source / References +I took inspiration from the Dockerfile of the [Grafana](https://github.com/grafana/grafana/) repository, especially [this file](https://github.com/grafana/grafana/blob/main/packaging/docker/run.sh). Thanks! \ No newline at end of file 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 a5f9127..0000000 --- a/root/etc/cont-init.d/98-vpn-config +++ /dev/null @@ -1,27 +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 update - 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 100644 index 7d49e79..0000000 --- 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 diff --git a/root/install-translations.sh b/root/install-translations.sh new file mode 100644 index 0000000..134adef --- /dev/null +++ b/root/install-translations.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +if [ ! -z "${TRANSLATIONS}" ]; then + OLDIFS=$IFS + IFS=',' + for translation in ${TRANSLATIONS}; do + IFS=$OLDIFS + echo "**** install translation: ${translation} ****" + curl -s -o "/tmp/${translation}.zip" -L "https://www.projectsend.org/translations/get.php?lang=${translation}" + unzip -o "/tmp/${translation}.zip" -d /app/projectsend; + done + echo "**** cleanup ****" + rm -rf /tmp/* +fi + +while :; do :; done & kill -STOP $! && wait $! \ No newline at end of file From fbf0da560ee8373695c0fdcb922adb320d63dfb4 Mon Sep 17 00:00:00 2001 From: Alexander Schomburg Date: Sun, 14 Nov 2021 22:09:52 +0100 Subject: [PATCH 2/6] Fixed typo in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe67db7..942b876 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Translations - Docker mod for projectsend -This mod adds installation options for adding translations to the [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend) for [ProjectSend](http://www.projectsend.org/). The translations to be installed can be defined with ``PS_INSTALL_TRANSLATIONS`` as a comma-separated list and will be automatically downloaded from the [official translations website](https://www.projectsend.org/translations/). To help translating (and adding your preferred language to) ProjectSend, please follow [this link](https://www.transifex.com/subwaydesign/projectsend/). +This mod adds installation options for adding translations to the [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend) for [ProjectSend](http://www.projectsend.org/). The translations to be installed can be defined with ``TRANSLATIONS`` as a comma-separated list and will be automatically downloaded from the [official translations website](https://www.projectsend.org/translations/). To help translating (and adding your preferred language to) ProjectSend, please follow [this link](https://www.transifex.com/subwaydesign/projectsend/). ## Using this Docker Mod @@ -33,4 +33,4 @@ services: ``` ## Source / References -I took inspiration from the Dockerfile of the [Grafana](https://github.com/grafana/grafana/) repository, especially [this file](https://github.com/grafana/grafana/blob/main/packaging/docker/run.sh). Thanks! \ No newline at end of file +I took inspiration from the Dockerfile of the [Grafana](https://github.com/grafana/grafana/) repository, especially [this file](https://github.com/grafana/grafana/blob/main/packaging/docker/run.sh). Thanks! From 197b7c62f1372f7ebf2614843cdf6298bd9fa3a3 Mon Sep 17 00:00:00 2001 From: Alexander Schomburg Date: Sun, 14 Nov 2021 22:30:27 +0100 Subject: [PATCH 3/6] Fixed naming convetion ProjectSend website speaks of ``translations`` instead of ``languages``. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b26acd..752385a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,6 @@ LABEL maintainer="alexschomb" # copy local files COPY root/ / -# install languages +# install translations RUN chmod +x /install-translations.sh -CMD /install-translations.sh \ No newline at end of file +CMD /install-translations.sh From 06f7b7bfb4e6a0d2022331e9c130db8f043fb501 Mon Sep 17 00:00:00 2001 From: Alexander Schomburg Date: Tue, 30 Nov 2021 20:45:22 +0100 Subject: [PATCH 4/6] Updated to use cont-init.d logic and added local translation option. --- Dockerfile | 15 ++++++++----- README.md | 9 ++++++-- .../cont-init.d/92-projectsend-translations | 21 +++++++++++++++++++ root/install-translations.sh | 16 -------------- 4 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 root/etc/cont-init.d/92-projectsend-translations delete mode 100644 root/install-translations.sh diff --git a/Dockerfile b/Dockerfile index 752385a..2c8793f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,15 @@ +FROM lsiobase/alpine:3.11 as buildstage + +# copy local files +COPY root/ /root-layer/ + +# runtime stage FROM scratch LABEL maintainer="alexschomb" -# copy local files -COPY root/ / +# Add files from buildstage +COPY --from=buildstage /root-layer/ / -# install translations -RUN chmod +x /install-translations.sh -CMD /install-translations.sh +# volumes +VOLUME /translations \ No newline at end of file diff --git a/README.md b/README.md index 942b876..460dcb3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Translations - Docker mod for projectsend -This mod adds installation options for adding translations to the [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend) for [ProjectSend](http://www.projectsend.org/). The translations to be installed can be defined with ``TRANSLATIONS`` as a comma-separated list and will be automatically downloaded from the [official translations website](https://www.projectsend.org/translations/). To help translating (and adding your preferred language to) ProjectSend, please follow [this link](https://www.transifex.com/subwaydesign/projectsend/). +This mod adds installation options for adding translations to the [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend) for [ProjectSend](http://www.projectsend.org/). The translations to be installed can be defined with ``TRANSLATIONS`` as a comma-separated list and can be either be automatically installed from the [official translations website](https://www.projectsend.org/translations/) or the local ``/translations`` volume. To help translating (and adding your preferred language to) ProjectSend, please follow [this link](https://www.transifex.com/subwaydesign/projectsend/). ## Using this Docker Mod To add this Docker Mod to your installation of the ProjectSend [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend), please add this endpoint ``linuxserver/mods:projectsend-translations`` to the ``DOCKER_MODS`` environment variable. You can install multiple Docker Mods by separating them by ``|``. [Read this page](https://github.com/linuxserver/docker-mods#using-a-docker-mod) for more information. -Now, you can define the languages/translations to be installed with their "Lang. code" value from the before mentioned [official translations website](https://www.projectsend.org/translations/) to the ``TRANSLATIONS`` environment variable. You can choose to install multiple translations by separating them with commas. The English translation ``en`` is automatically installed by the ProjectSend image and does not have to be addressed by this Docker Mod or the ``TRANSLATIONS`` environment variable. +Now, you can define the languages/translations to be installed with their name to the ``TRANSLATIONS`` environment variable. You can choose to install multiple translations by separating them with commas. You can either install them by providing the folder name of a subfolder in the new ``/translations`` volume, or the "Lang. code" value from the before mentioned [official translations website](https://www.projectsend.org/translations/). The English translation ``en`` is automatically installed by the ProjectSend image and does not have to be addressed by this Docker Mod or the ``TRANSLATIONS`` environment variable. Full example with ``docker-compose``: @@ -27,10 +27,15 @@ services: volumes: - :/config - :/data + - :/translations ports: - 80:80 restart: unless-stopped ``` +### Known limitations + +* Translations will only update when rebuilding the base image (``docker-compose down && docker-compose up -d --rebuild``), a simple ``docker-compose restart`` is not sufficient. This is because the [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend) does not work with mounted volumes inside ``/app/projectsend/``. As a result, translation development can be very uncomfortable using this approach. Sorry. + ## Source / References I took inspiration from the Dockerfile of the [Grafana](https://github.com/grafana/grafana/) repository, especially [this file](https://github.com/grafana/grafana/blob/main/packaging/docker/run.sh). Thanks! diff --git a/root/etc/cont-init.d/92-projectsend-translations b/root/etc/cont-init.d/92-projectsend-translations new file mode 100644 index 0000000..c9a8334 --- /dev/null +++ b/root/etc/cont-init.d/92-projectsend-translations @@ -0,0 +1,21 @@ +#!/usr/bin/with-contenv bash + +if [ ! -z "${TRANSLATIONS}" ]; then + OLDIFS=$IFS + IFS=',' + for translation in ${TRANSLATIONS}; do + IFS=$OLDIFS + if [[ -d "/translations/${translation}" ]]; then + echo "**** install local translation: ${translation} ****" + cp -R "/translations/${translation}/*" /app/projectsend/ + else + echo "**** install online translation: ${translation} ****" + curl -s -o "/tmp/${translation}.zip" -L "https://www.projectsend.org/translations/get.php?lang=${translation}" + unzip -o "/tmp/${translation}.zip" -d /app/projectsend; + fi + done + echo "**** cleanup ****" + rm -rf /tmp/* +fi + +while :; do :; done & kill -STOP $! && wait $! \ No newline at end of file diff --git a/root/install-translations.sh b/root/install-translations.sh deleted file mode 100644 index 134adef..0000000 --- a/root/install-translations.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -e - -if [ ! -z "${TRANSLATIONS}" ]; then - OLDIFS=$IFS - IFS=',' - for translation in ${TRANSLATIONS}; do - IFS=$OLDIFS - echo "**** install translation: ${translation} ****" - curl -s -o "/tmp/${translation}.zip" -L "https://www.projectsend.org/translations/get.php?lang=${translation}" - unzip -o "/tmp/${translation}.zip" -d /app/projectsend; - done - echo "**** cleanup ****" - rm -rf /tmp/* -fi - -while :; do :; done & kill -STOP $! && wait $! \ No newline at end of file From fbbbbaa148dab800eaab0742b27994a3f45d10b4 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 19 May 2023 09:29:25 -0400 Subject: [PATCH 5/6] switch to s6v3, general cleanup, add/update workflows --- .github/workflows/BuildImage.yml | 83 ++++++++----------- .github/workflows/call_issue_pr_tracker.yml | 16 ++++ .github/workflows/permissions.yml | 10 +++ Dockerfile | 11 +-- README.md | 4 - .../dependencies.d/init-mods | 0 .../init-mod-projectsend-translations/run} | 2 - .../init-mod-projectsend-translations/type | 1 + .../init-mod-projectsend-translations/up | 1 + .../init-mod-projectsend-translations | 0 .../user/init-mod-projectsend-translations | 0 11 files changed, 66 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/call_issue_pr_tracker.yml create mode 100644 .github/workflows/permissions.yml create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/dependencies.d/init-mods rename root/etc/{cont-init.d/92-projectsend-translations => s6-overlay/s6-rc.d/init-mod-projectsend-translations/run} (93%) mode change 100644 => 100755 create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/type create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/up create mode 100644 root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-projectsend-translations create mode 100644 root/etc/s6-overlay/s6-rc.d/user/init-mod-projectsend-translations diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index f70ee9d..d24abee 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -1,56 +1,45 @@ name: Build Image -on: [push, pull_request, workflow_dispatch] +on: [push, pull_request_target, workflow_dispatch] env: - ENDPOINT: "linuxserver/mods" - BASEIMAGE: "projectsend" - MODNAME: "translations" + GITHUB_REPO: "linuxserver/docker-mods" #don't modify + ENDPOINT: "linuxserver/mods" #don't modify + BASEIMAGE: "projectsend" #replace + MODNAME: "translations" #replace jobs: - build: + set-vars: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.3 + - name: Set Vars + id: outputs + run: | + 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: 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 }} - 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 - - 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} \ No newline at end of file + 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 0000000..2c30784 --- /dev/null +++ b/.github/workflows/call_issue_pr_tracker.yml @@ -0,0 +1,16 @@ +name: Issue & PR Tracker + +on: + issues: + types: [opened,reopened,labeled,unlabeled,closed] + pull_request_target: + types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled,closed] + pull_request_review: + types: [submitted,edited,dismissed] + +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 new file mode 100644 index 0000000..1447bc5 --- /dev/null +++ b/.github/workflows/permissions.yml @@ -0,0 +1,10 @@ +name: Permission check +on: + 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/Dockerfile b/Dockerfile index 2c8793f..fe8e224 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,8 @@ -FROM lsiobase/alpine:3.11 as buildstage +# syntax=docker/dockerfile:1 -# copy local files -COPY root/ /root-layer/ - -# runtime stage FROM scratch LABEL maintainer="alexschomb" # Add files from buildstage -COPY --from=buildstage /root-layer/ / - -# volumes -VOLUME /translations \ No newline at end of file +COPY root/ / diff --git a/README.md b/README.md index 460dcb3..8e3aca4 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,5 @@ services: restart: unless-stopped ``` -### Known limitations - -* Translations will only update when rebuilding the base image (``docker-compose down && docker-compose up -d --rebuild``), a simple ``docker-compose restart`` is not sufficient. This is because the [Docker image of LinuxServer.io](https://github.com/linuxserver/docker-projectsend) does not work with mounted volumes inside ``/app/projectsend/``. As a result, translation development can be very uncomfortable using this approach. Sorry. - ## Source / References I took inspiration from the Dockerfile of the [Grafana](https://github.com/grafana/grafana/) repository, especially [this file](https://github.com/grafana/grafana/blob/main/packaging/docker/run.sh). Thanks! diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/dependencies.d/init-mods b/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/dependencies.d/init-mods new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/cont-init.d/92-projectsend-translations b/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/run old mode 100644 new mode 100755 similarity index 93% rename from root/etc/cont-init.d/92-projectsend-translations rename to root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/run index c9a8334..670b100 --- a/root/etc/cont-init.d/92-projectsend-translations +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/run @@ -17,5 +17,3 @@ if [ ! -z "${TRANSLATIONS}" ]; then echo "**** cleanup ****" rm -rf /tmp/* fi - -while :; do :; done & kill -STOP $! && wait $! \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/type b/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/up b/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/up new file mode 100644 index 0000000..4cb9a1c --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-mod-projectsend-translations/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-projectsend-translations b/root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-projectsend-translations new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/init-mod-projectsend-translations b/root/etc/s6-overlay/s6-rc.d/user/init-mod-projectsend-translations new file mode 100644 index 0000000..e69de29 From d284bc4050751b664f86fbc295db48d138e25391 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Fri, 19 May 2023 09:30:52 -0400 Subject: [PATCH 6/6] fix comment --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fe8e224..a685b17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,5 +4,5 @@ FROM scratch LABEL maintainer="alexschomb" -# Add files from buildstage +# copy local files COPY root/ /