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:
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 }}

View file

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

View file

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

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 && \
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"]

View file

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

View file

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