From 4d3ff091aa1c06032ce41ec5d82ee5c445a29687 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 5 Apr 2021 09:21:58 -0300 Subject: [PATCH 1/2] feat: docker images Signed-off-by: Carlos Alexandro Becker --- .editorconfig | 6 +++- .github/workflows/docker-images-rpi.yml | 40 ------------------------- .github/workflows/docker-images.yml | 35 +++++++++++++--------- docker/images/n8n-rpi/Dockerfile | 21 ------------- docker/images/n8n-rpi/README.md | 22 -------------- docker/images/n8n/README.md | 4 +-- 6 files changed, 28 insertions(+), 100 deletions(-) delete mode 100644 .github/workflows/docker-images-rpi.yml delete mode 100644 docker/images/n8n-rpi/Dockerfile delete mode 100644 docker/images/n8n-rpi/README.md diff --git a/.editorconfig b/.editorconfig index 5d02a5688b..c6f30f2512 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,4 +12,8 @@ indent_style = space indent_size = 2 [*.ts] -quote_type = single \ No newline at end of file +quote_type = single + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/docker-images-rpi.yml b/.github/workflows/docker-images-rpi.yml deleted file mode 100644 index 1eeb66ecdb..0000000000 --- a/.github/workflows/docker-images-rpi.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Docker Image CI - Rpi - -on: - push: - tags: - - n8n@* - workflow_dispatch: - inputs: - version: - description: 'n8n version to build docker image for.' - required: true - default: '0.112.0' - -jobs: - armv7_job: - runs-on: ubuntu-18.04 - name: Build on ARMv7 (Rpi) - steps: - - uses: actions/checkout@v1 - - name: Get the version - id: vars - run: echo ::set-output name=tag::$(echo ${GITHUB_REF:14}) - - - name: Log in to Docker registry - run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - - - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v3 - with: - buildx-version: latest - qemu-version: latest - - name: Run Buildx (push image) - if: success() - run: | - docker buildx build \ - --platform linux/arm/v7 \ - --build-arg N8N_VERSION=${{github.event.inputs.version || steps.vars.outputs.tag}} \ - -t ${{ secrets.DOCKER_USERNAME }}/n8n:${{github.event.inputs.version || steps.vars.outputs.tag}}-rpi \ - -t ${{ secrets.DOCKER_USERNAME }}/n8n:latest-rpi \ - --output type=image,push=true docker/images/n8n-rpi diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 1a9b81d09f..a6d8496772 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -19,20 +19,27 @@ jobs: - name: Log in to Docker registry run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + - name: Set up Docker Buildx + uses: crazy-max/ghaction-docker-buildx@v3 + with: + buildx-version: latest + qemu-version: latest + - name: Build the Docker image of version - run: docker build --build-arg N8N_VERSION=${{steps.vars.outputs.tag}} -t n8nio/n8n:${{steps.vars.outputs.tag}} docker/images/n8n - - name: Push Docker image of version - run: docker push n8nio/n8n:${{steps.vars.outputs.tag}} - - name: Tag Docker image with latest - run: docker tag n8nio/n8n:${{steps.vars.outputs.tag}} n8nio/n8n:latest - - name: Push docker images of latest - run: docker push n8nio/n8n:latest + if: success() + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64,linux/arm/v7 \ + --build-arg N8N_VERSION=${{steps.vars.outputs.tag}} \ + -t ${{ secrets.DOCKER_USERNAME }}/n8n:${{steps.vars.outputs.tag}} \ + -t ${{ secrets.DOCKER_USERNAME }}/n8n:latest \ + --output type=image,push=true docker/images/n8n - name: Build the Docker image of version (Debian) - run: docker build --build-arg N8N_VERSION=${{steps.vars.outputs.tag}} -t n8nio/n8n:${{steps.vars.outputs.tag}}-debian docker/images/n8n-debian - - name: Push Docker image of version (Debian) - run: docker push n8nio/n8n:${{steps.vars.outputs.tag}}-debian - - name: Tag Docker image with latest (Debian) - run: docker tag n8nio/n8n:${{steps.vars.outputs.tag}}-debian n8nio/n8n:latest-debian - - name: Push docker images of latest (Debian) - run: docker push n8nio/n8n:latest-debian + run: | + docker buildx build \ + --platform linux/amd64 \ + --build-arg N8N_VERSION=${{steps.vars.outputs.tag}} \ + -t ${{ secrets.DOCKER_USERNAME }}/n8n:${{steps.vars.outputs.tag}}-debian \ + -t ${{ secrets.DOCKER_USERNAME }}/n8n:latest-debian \ + --output type=image,push=true docker/images/n8n-debian diff --git a/docker/images/n8n-rpi/Dockerfile b/docker/images/n8n-rpi/Dockerfile deleted file mode 100644 index 329b7e7dfe..0000000000 --- a/docker/images/n8n-rpi/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM arm32v7/node:14.15 - -ARG N8N_VERSION - -RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi - -RUN \ - apt-get update && \ - apt-get -y install graphicsmagick gosu - -RUN npm_config_user=root npm install -g full-icu n8n@${N8N_VERSION} - -ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu -ENV NODE_ENV production - -WORKDIR /data - -USER root - -CMD chown -R node:node /home/node/.n8n \ -&& gosu node n8n diff --git a/docker/images/n8n-rpi/README.md b/docker/images/n8n-rpi/README.md deleted file mode 100644 index cc15b0c9d8..0000000000 --- a/docker/images/n8n-rpi/README.md +++ /dev/null @@ -1,22 +0,0 @@ -## n8n - Raspberry PI Docker Image - -Dockerfile to build n8n for Raspberry PI. - -For information about how to run n8n with Docker check the generic -[Docker-Readme](https://github.com/n8n-io/n8n/tree/master/docker/images/n8n/README.md) - - -``` -docker build --build-arg N8N_VERSION= -t n8nio/n8n: . - -# For example: -docker build --build-arg N8N_VERSION=0.43.0 -t n8nio/n8n:0.43.0-rpi . -``` - -``` -docker run -it --rm \ - --name n8n \ - -p 5678:5678 \ - -v ~/.n8n:/home/node/.n8n \ - n8nio/n8n:0.70.0-rpi -``` diff --git a/docker/images/n8n/README.md b/docker/images/n8n/README.md index ef0d7123e7..4c0fff5ceb 100644 --- a/docker/images/n8n/README.md +++ b/docker/images/n8n/README.md @@ -226,10 +226,10 @@ docker run -it --rm \ ## Build Docker-Image ``` -docker build --build-arg N8N_VERSION= -t n8nio/n8n: . +docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg N8N_VERSION= -t n8nio/n8n: . # For example: -docker build --build-arg N8N_VERSION=0.18.1 -t n8nio/n8n:0.18.1 . +docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg N8N_VERSION=0.114.0 -t n8nio/n8n:0.114.0 . ``` From 061e990d87dd1da1b5a136b9cfeaa31c9c316db8 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 5 Apr 2021 10:22:04 -0300 Subject: [PATCH 2/2] fix: workflow Signed-off-by: Carlos Alexandro Becker --- .github/workflows/docker-images.yml | 57 +++++++++++++++-------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index a6d8496772..8b9e32e0bf 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -6,40 +6,41 @@ on: - n8n@* jobs: - build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - name: Get the version id: vars run: echo ::set-output name=tag::$(echo ${GITHUB_REF:14}) - - name: Log in to Docker registry - run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v3 + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 with: - buildx-version: latest - qemu-version: latest - - - name: Build the Docker image of version - if: success() - run: | - docker buildx build \ - --platform linux/amd64,linux/arm64,linux/arm/v7 \ - --build-arg N8N_VERSION=${{steps.vars.outputs.tag}} \ - -t ${{ secrets.DOCKER_USERNAME }}/n8n:${{steps.vars.outputs.tag}} \ - -t ${{ secrets.DOCKER_USERNAME }}/n8n:latest \ - --output type=image,push=true docker/images/n8n - - - name: Build the Docker image of version (Debian) - run: | - docker buildx build \ - --platform linux/amd64 \ - --build-arg N8N_VERSION=${{steps.vars.outputs.tag}} \ - -t ${{ secrets.DOCKER_USERNAME }}/n8n:${{steps.vars.outputs.tag}}-debian \ - -t ${{ secrets.DOCKER_USERNAME }}/n8n:latest-debian \ - --output type=image,push=true docker/images/n8n-debian + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build + uses: docker/build-push-action@v2 + with: + context: ./docker/images/n8n + build-args: | + N8N_VERSION=${{steps.vars.outputs.tag}} + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + ${{ secrets.DOCKER_USERNAME }}/n8n:${{ steps.vars.outputs.tag }} + ${{ secrets.DOCKER_USERNAME }}/n8n:latest + - name: Build (debian) + uses: docker/build-push-action@v2 + with: + context: ./docker/images/n8n-debian + build-args: | + N8N_VERSION=${{ steps.vars.outputs.tag }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + ${{ secrets.DOCKER_USERNAME }}/n8n:${{ steps.vars.outputs.tag }}-debian + ${{ secrets.DOCKER_USERNAME }}/n8n:latest-debian