Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): revert docker USER and WORKDIR changes #3992

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions docker/images/n8n/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ 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

RUN \
mkdir .n8n && \
chown node:node .n8n && \
ln -s /docker-entrypoint.sh /home/node/docker-entrypoint.sh
USER node
COPY docker-entrypoint.sh ./
ENTRYPOINT ["tini", "--", "./docker-entrypoint.sh"]
# Set a custom user to not have n8n run as root
USER root
WORKDIR /data
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
13 changes: 11 additions & 2 deletions docker/images/n8n/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/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 node "$@"
exec su-exec node "$@"
else
# Got started without arguments
exec n8n
exec su-exec n8n
fi