From d812c86812882a0d15d4530b127cd9b4e206b1f2 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 18 Oct 2020 19:18:51 +0200 Subject: [PATCH] docker: push images to GHCR too use numeric id for user inside Dockerfile --- .github/workflows/docker.yml | 19 ++++++++++++++++--- Dockerfile | 2 +- Dockerfile.alpine | 2 +- docker/README.md | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a510230c..55fc5155 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,7 +18,12 @@ jobs: matrix: os: - ubuntu-latest - docker_pkg: [debian, alpine] + docker_pkg: + - debian + - alpine + docker_image: + - drakkan/sftpgo + - ghcr.io/drakkan/sftpgo steps: - name: Checkout uses: actions/checkout@v2 @@ -34,7 +39,6 @@ jobs: - name: Gather image information id: info run: | - DOCKER_IMAGE=drakkan/sftpgo VERSION=noop DOCKERFILE=Dockerfile MINOR="" @@ -80,6 +84,7 @@ jobs: echo ::set-output name=sha::${GITHUB_SHA::8} env: DOCKER_PKG: ${{ matrix.docker_pkg }} + DOCKER_IMAGE: ${{ matrix.docker_image }} - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -92,7 +97,15 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - if: github.event_name != 'pull_request' + if: ${{ github.event_name != 'pull_request' && matrix.docker_image == 'drakkan/sftpgo' }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + if: ${{ github.event_name != 'pull_request' && matrix.docker_image == 'ghcr.io/drakkan/sftpgo' }} - name: Build and push uses: docker/build-push-action@v2 diff --git a/Dockerfile b/Dockerfile index 0c5d2d8f..0318ea23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,7 +60,7 @@ RUN chown -R sftpgo:sftpgo /etc/sftpgo && chown sftpgo:sftpgo /var/lib/sftpgo /s chmod 750 /etc/sftpgo /var/lib/sftpgo /srv/sftpgo WORKDIR /var/lib/sftpgo -USER sftpgo +USER 1000:1000 VOLUME [ "/var/lib/sftpgo", "/srv/sftpgo" ] diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 2beaf66d..8e67ae4f 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -65,7 +65,7 @@ RUN chown -R sftpgo:sftpgo /etc/sftpgo && chown sftpgo:sftpgo /var/lib/sftpgo /s chmod 750 /etc/sftpgo /var/lib/sftpgo /srv/sftpgo WORKDIR /var/lib/sftpgo -USER sftpgo +USER 1000:1000 VOLUME [ "/var/lib/sftpgo", "/srv/sftpgo" ] diff --git a/docker/README.md b/docker/README.md index a1c49890..3fa4650f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,6 +1,6 @@ # Official Docker image -SFTPGo provides an official Docker image, it is available on [Docker Hub](https://hub.docker.com/r/drakkan/sftpgo). +SFTPGo provides an official Docker image, it is available on both [Docker Hub](https://hub.docker.com/r/drakkan/sftpgo) and on [GitHub Container Registry](https://github.com/users/drakkan/packages/container/package/sftpgo). ## Supported tags and respective Dockerfile links