Skip to content

Commit

Permalink
ci!: Update docker images for v1 release (#6365)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
netroy committed Jun 22, 2023
1 parent f636616 commit f024d8b
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 135 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
docker-context: ['', '-debian']

steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions docker/images/n8n-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
5 changes: 3 additions & 2 deletions docker/images/n8n-custom/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 && \
Expand Down
8 changes: 0 additions & 8 deletions docker/images/n8n-custom/docker-entrypoint.sh

This file was deleted.

24 changes: 0 additions & 24 deletions docker/images/n8n-debian/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions docker/images/n8n-debian/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions docker/images/n8n-debian/docker-entrypoint.sh

This file was deleted.

24 changes: 0 additions & 24 deletions docker/images/n8n-rhel7/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions docker/images/n8n-rhel7/README.md

This file was deleted.

11 changes: 6 additions & 5 deletions docker/images/n8n/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
13 changes: 2 additions & 11 deletions docker/images/n8n/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions docker/images/n8n/hooks/build

This file was deleted.

0 comments on commit f024d8b

Please sign in to comment.