ci!: Update docker images for v1 release (#6365)

* ci: Remove debian and rhel7 images

* include libc6-compat in all alpine images

* run all n8n docker containers as the user `node` instead of `root`

* upgrade the default version of npm bundled in all containers

* consolidate docker entrypoints
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-06-07 13:28:06 +02:00 committed by कारतोफ्फेलस्क्रिप्ट™
parent f6366160a4
commit f024d8be5a
12 changed files with 16 additions and 135 deletions

View file

@ -8,10 +8,6 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
docker-context: ['', '-debian']
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -41,12 +37,12 @@ jobs:
- name: Build - name: Build
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: ./docker/images/n8n${{ matrix.docker-context }} context: ./docker/images/n8n
build-args: | build-args: |
N8N_VERSION=${{ steps.vars.outputs.tag }} N8N_VERSION=${{ steps.vars.outputs.tag }}
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
provenance: false provenance: false
push: true push: true
tags: | tags: |
${{ secrets.DOCKER_USERNAME }}/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 }}${{ matrix.docker-context }} ghcr.io/${{ github.repository_owner }}/n8n:${{ steps.vars.outputs.tag }}

View file

@ -5,8 +5,8 @@ WORKDIR /home/node
COPY .npmrc /usr/local/etc/npmrc COPY .npmrc /usr/local/etc/npmrc
RUN \ RUN \
apk add --update git openssh graphicsmagick tini tzdata ca-certificates && \ apk add --update git openssh graphicsmagick tini tzdata ca-certificates libc6-compat && \
npm install -g npm@8.19.2 full-icu && \ npm install -g npm@9.5.1 full-icu && \
rm -rf /var/cache/apk/* /root/.npm /tmp/* && \ rm -rf /var/cache/apk/* /root/.npm /tmp/* && \
# Install fonts # Install fonts
apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \ apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \

View file

@ -8,7 +8,7 @@ COPY --chown=node:node scripts ./scripts
COPY --chown=node:node packages ./packages COPY --chown=node:node packages ./packages
COPY --chown=node:node patches ./patches COPY --chown=node:node patches ./patches
RUN apk add --update libc6-compat jq RUN apk add --update jq
RUN corepack enable && corepack prepare --activate RUN corepack enable && corepack prepare --activate
USER node USER node
@ -28,7 +28,8 @@ RUN rm -rf patches .npmrc *.yaml node_modules/.cache packages/**/node_modules/.c
FROM n8nio/base:${NODE_VERSION} FROM n8nio/base:${NODE_VERSION}
COPY --from=builder /home/node /usr/local/lib/node_modules/n8n 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 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 \ RUN \
mkdir .n8n && \ mkdir .n8n && \

View file

@ -1,8 +0,0 @@
#!/bin/sh
if [ "$#" -gt 0 ]; then
# Got started with arguments
node "$@"
else
# Got started without arguments
n8n
fi

View file

@ -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

View file

@ -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=<VERSION> -t n8nio/n8n:<VERSION> .
# 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
```

View file

@ -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

View file

@ -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"

View file

@ -1,15 +0,0 @@
## Build Docker-Image
```
docker build --build-arg N8N_VERSION=<VERSION> -t n8nio/n8n:<VERSION> .
# 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
```

View file

@ -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 && \ find /usr/local/lib/node_modules/n8n -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" | xargs rm && \
rm -rf /root/.npm rm -rf /root/.npm
# Set a custom user to not have n8n run as root COPY docker/images/n8n/docker-entrypoint.sh /
USER root
WORKDIR /data RUN \
RUN apk --no-cache add su-exec mkdir .n8n && \
COPY docker-entrypoint.sh /docker-entrypoint.sh chown node:node .n8n
USER node
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"] ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]

View file

@ -1,17 +1,8 @@
#!/bin/sh #!/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 if [ "$#" -gt 0 ]; then
# Got started with arguments # Got started with arguments
exec su-exec node "$@" node "$@"
else else
# Got started without arguments # Got started without arguments
exec su-exec node n8n n8n
fi fi

View file

@ -1,2 +0,0 @@
#!/bin/bash
docker build --build-arg N8N_VERSION=$DOCKER_TAG -f $DOCKERFILE_PATH -t $IMAGE_NAME .