diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 0064f7eabc..ce80e69188 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -8,10 +8,6 @@ jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - docker-context: ['', '-debian'] - steps: - uses: actions/checkout@v3 @@ -41,12 +37,12 @@ jobs: - name: Build uses: docker/build-push-action@v4 with: - context: ./docker/images/n8n${{ matrix.docker-context }} + context: ./docker/images/n8n build-args: | N8N_VERSION=${{ steps.vars.outputs.tag }} platforms: linux/amd64,linux/arm64,linux/arm/v7 provenance: false push: true tags: | - ${{ secrets.DOCKER_USERNAME }}/n8n:${{ steps.vars.outputs.tag }}${{ matrix.docker-context }} - ghcr.io/${{ github.repository_owner }}/n8n:${{ steps.vars.outputs.tag }}${{ matrix.docker-context }} + ${{ secrets.DOCKER_USERNAME }}/n8n:${{ steps.vars.outputs.tag }} + ghcr.io/${{ github.repository_owner }}/n8n:${{ steps.vars.outputs.tag }} diff --git a/docker/images/n8n-base/Dockerfile b/docker/images/n8n-base/Dockerfile index bd7b5b96f2..412a45b44a 100644 --- a/docker/images/n8n-base/Dockerfile +++ b/docker/images/n8n-base/Dockerfile @@ -5,8 +5,8 @@ WORKDIR /home/node COPY .npmrc /usr/local/etc/npmrc RUN \ - apk add --update git openssh graphicsmagick tini tzdata ca-certificates && \ - npm install -g npm@8.19.2 full-icu && \ + apk add --update git openssh graphicsmagick tini tzdata ca-certificates libc6-compat && \ + npm install -g npm@9.5.1 full-icu && \ rm -rf /var/cache/apk/* /root/.npm /tmp/* && \ # Install fonts apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \ diff --git a/docker/images/n8n-custom/Dockerfile b/docker/images/n8n-custom/Dockerfile index 8f7343a6cc..03dc11c4b9 100644 --- a/docker/images/n8n-custom/Dockerfile +++ b/docker/images/n8n-custom/Dockerfile @@ -8,7 +8,7 @@ COPY --chown=node:node scripts ./scripts COPY --chown=node:node packages ./packages COPY --chown=node:node patches ./patches -RUN apk add --update libc6-compat jq +RUN apk add --update jq RUN corepack enable && corepack prepare --activate USER node @@ -28,7 +28,8 @@ RUN rm -rf patches .npmrc *.yaml node_modules/.cache packages/**/node_modules/.c FROM n8nio/base:${NODE_VERSION} COPY --from=builder /home/node /usr/local/lib/node_modules/n8n RUN ln -s /usr/local/lib/node_modules/n8n/packages/cli/bin/n8n /usr/local/bin/n8n -COPY docker/images/n8n-custom/docker-entrypoint.sh / + +COPY docker/images/n8n/docker-entrypoint.sh / RUN \ mkdir .n8n && \ diff --git a/docker/images/n8n-custom/docker-entrypoint.sh b/docker/images/n8n-custom/docker-entrypoint.sh deleted file mode 100755 index 42419b3924..0000000000 --- a/docker/images/n8n-custom/docker-entrypoint.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -if [ "$#" -gt 0 ]; then - # Got started with arguments - node "$@" -else - # Got started without arguments - n8n -fi diff --git a/docker/images/n8n-debian/Dockerfile b/docker/images/n8n-debian/Dockerfile deleted file mode 100644 index 8bc7cc982c..0000000000 --- a/docker/images/n8n-debian/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM node:16 - -ARG N8N_VERSION - -RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi - -ENV N8N_VERSION=${N8N_VERSION} -RUN \ - apt-get update && \ - apt-get -y install graphicsmagick gosu git - -# Set a custom user to not have n8n run as root -USER root - -RUN npm_config_user=root npm install -g npm@8.19.2 full-icu n8n@${N8N_VERSION} - -ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu - -WORKDIR /data - -COPY docker-entrypoint.sh /docker-entrypoint.sh -ENTRYPOINT ["/docker-entrypoint.sh"] - -EXPOSE 5678/tcp diff --git a/docker/images/n8n-debian/README.md b/docker/images/n8n-debian/README.md deleted file mode 100644 index 236305e8ea..0000000000 --- a/docker/images/n8n-debian/README.md +++ /dev/null @@ -1,20 +0,0 @@ -## n8n - Debian Docker Image - -Dockerfile to build n8n with Debian. - -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-debian . -``` - -``` -docker run -it --rm \ - --name n8n \ - -p 5678:5678 \ - n8nio/n8n:0.43.0-debian -``` diff --git a/docker/images/n8n-debian/docker-entrypoint.sh b/docker/images/n8n-debian/docker-entrypoint.sh deleted file mode 100755 index 80a252f31e..0000000000 --- a/docker/images/n8n-debian/docker-entrypoint.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -if [ -d /root/.n8n ] ; then - chmod o+rx /root - chown -R node /root/.n8n - ln -s /root/.n8n /home/node/ -fi - -if [ "$#" -gt 0 ]; then - # Got started with arguments - exec gosu node "$@" -else - # Got started without arguments - exec gosu node n8n -fi diff --git a/docker/images/n8n-rhel7/Dockerfile b/docker/images/n8n-rhel7/Dockerfile deleted file mode 100644 index 09fd0ad019..0000000000 --- a/docker/images/n8n-rhel7/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM richxsl/rhel7 - -ARG N8N_VERSION - -RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi - -ENV N8N_VERSION=${N8N_VERSION} -RUN \ - yum install -y gcc-c++ make - -RUN \ - curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash - - -RUN \ - sudo yum install nodejs - -# Set a custom user to not have n8n run as root -USER root - -RUN npm_config_user=root npm install -g npm@8.19.2 n8n@${N8N_VERSION} - -WORKDIR /data - -CMD "n8n" diff --git a/docker/images/n8n-rhel7/README.md b/docker/images/n8n-rhel7/README.md deleted file mode 100644 index 559aec3fa2..0000000000 --- a/docker/images/n8n-rhel7/README.md +++ /dev/null @@ -1,15 +0,0 @@ -## Build Docker-Image - -``` -docker build --build-arg N8N_VERSION= -t n8nio/n8n: . - -# For example: -docker build --build-arg N8N_VERSION=0.36.1 -t n8nio/n8n:0.36.1-rhel7 . -``` - -``` -docker run -it --rm \ - --name n8n \ - -p 5678:5678 \ - n8nio/n8n:0.25.0-ubuntu -``` diff --git a/docker/images/n8n/Dockerfile b/docker/images/n8n/Dockerfile index c85ef12a66..93fb29618b 100644 --- a/docker/images/n8n/Dockerfile +++ b/docker/images/n8n/Dockerfile @@ -18,9 +18,10 @@ RUN set -eux; \ find /usr/local/lib/node_modules/n8n -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" | xargs rm && \ rm -rf /root/.npm -# Set a custom user to not have n8n run as root -USER root -WORKDIR /data -RUN apk --no-cache add su-exec -COPY docker-entrypoint.sh /docker-entrypoint.sh +COPY docker/images/n8n/docker-entrypoint.sh / + +RUN \ + mkdir .n8n && \ + chown node:node .n8n +USER node ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"] diff --git a/docker/images/n8n/docker-entrypoint.sh b/docker/images/n8n/docker-entrypoint.sh index fa81b3713c..42419b3924 100755 --- a/docker/images/n8n/docker-entrypoint.sh +++ b/docker/images/n8n/docker-entrypoint.sh @@ -1,17 +1,8 @@ #!/bin/sh - -if [ -d /root/.n8n ] ; then - chmod o+rx /root - chown -R node /root/.n8n - ln -s /root/.n8n /home/node/ -fi - -chown -R node /home/node - if [ "$#" -gt 0 ]; then # Got started with arguments - exec su-exec node "$@" + node "$@" else # Got started without arguments - exec su-exec node n8n + n8n fi diff --git a/docker/images/n8n/hooks/build b/docker/images/n8n/hooks/build deleted file mode 100644 index a09c622456..0000000000 --- a/docker/images/n8n/hooks/build +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker build --build-arg N8N_VERSION=$DOCKER_TAG -f $DOCKERFILE_PATH -t $IMAGE_NAME .