mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
* reduce redundant code between the two alpine Dockerfiles * reduce the docker image build times * reduce the `n8n` image size from 1.17GB to 462MB * reduce the `n8n-custom` image size from 671MB to 460MB * reduce the size of npm tree by making all typing packages devDependencies Partially resolves this ticket: N8N-3252
23 lines
717 B
Docker
23 lines
717 B
Docker
ARG NODE_VERSION=16
|
|
FROM n8nio/base:${NODE_VERSION}
|
|
|
|
ARG N8N_VERSION
|
|
RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi
|
|
|
|
ENV NODE_ENV=production
|
|
RUN set -eux; \
|
|
apkArch="$(apk --print-arch)"; \
|
|
case "$apkArch" in \
|
|
'armv7') apk --no-cache add --virtual build-dependencies python3 build-base;; \
|
|
esac && \
|
|
npm install --loglevel=info -g --omit=dev n8n@${N8N_VERSION} && \
|
|
case "$apkArch" in \
|
|
'armv7') apk del build-dependencies;; \
|
|
esac && \
|
|
find /usr/local/lib/node_modules/n8n -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" | xargs rm && \
|
|
rm -rf /root/.npm
|
|
|
|
USER node
|
|
COPY docker-entrypoint.sh ./
|
|
ENTRYPOINT ["tini", "--", "./docker-entrypoint.sh"]
|