From bb8c0d264eb05bec6391b6e4b5b1126e8e364fef Mon Sep 17 00:00:00 2001 From: Redblueflame Date: Sun, 28 Mar 2021 21:27:17 +0200 Subject: [PATCH] Github Container Registry support (#125) * Initial tests for ghcr.io integration * Fixed login issue * Try with only GHCR * Removed unused system * Time to break everything with hub.docker.com support * Fix format error * Update dockerfile to use latest recommended version of nodejs. --- .github/workflows/docker-compile-master.yml | 21 -------- .github/workflows/docker-compile-tag.yml | 22 --------- .github/workflows/docker-compile.yml | 55 +++++++++++++++++++++ Dockerfile | 2 +- 4 files changed, 56 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/docker-compile-master.yml delete mode 100644 .github/workflows/docker-compile-tag.yml create mode 100644 .github/workflows/docker-compile.yml diff --git a/.github/workflows/docker-compile-master.yml b/.github/workflows/docker-compile-master.yml deleted file mode 100644 index fc9dcd0d3..000000000 --- a/.github/workflows/docker-compile-master.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Docker image build - -on: - push: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Build and push Docker images - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: modrinth/knossos - tag_with_ref: false - tags: master - tag_with_sha: true diff --git a/.github/workflows/docker-compile-tag.yml b/.github/workflows/docker-compile-tag.yml deleted file mode 100644 index deb344bde..000000000 --- a/.github/workflows/docker-compile-tag.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Docker image build - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Build and push Docker images - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: modrinth/knossos - tag_with_ref: true - tags: latest - tag_with_sha: true diff --git a/.github/workflows/docker-compile.yml b/.github/workflows/docker-compile.yml new file mode 100644 index 000000000..56f580c2d --- /dev/null +++ b/.github/workflows/docker-compile.yml @@ -0,0 +1,55 @@ +name: docker-build + +on: + push: + branches: + - '**' + tags: + - 'v*' + pull_request: + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: | + ghcr.io/modrinth/knossos + docker.io/modrinth/knossos + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Login to DockerHub + uses: docker/login-action@v1 + if: github.event_name != 'pull_request' + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 89c505e78..e5781aa1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Dockerfile -FROM node:11.13.0-alpine +FROM node:14.16.0-alpine # create destination directory RUN mkdir -p /usr/src/knossos