mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-12 16:10:30 +02:00
ci: Optimize Docker image build process (#23149)
This commit is contained in:
parent
3dcb98b6f7
commit
890ca377f2
|
|
@ -1,21 +1,27 @@
|
|||
# We want to include the THIRD_PARTY_LICENSES.md file in the Docker image,
|
||||
# but not other .md files
|
||||
**/*.md
|
||||
!**/THIRD_PARTY_LICENSES.md
|
||||
**/.env
|
||||
.cache
|
||||
assets
|
||||
node_modules
|
||||
packages/node-dev
|
||||
packages/**/node_modules
|
||||
packages/**/dist
|
||||
packages/**/.turbo
|
||||
packages/**/*.test.*
|
||||
.git
|
||||
.github
|
||||
!.github/scripts
|
||||
*.tsbuildinfo
|
||||
docker/compose
|
||||
docker/**/Dockerfile
|
||||
.vscode
|
||||
packages/testing
|
||||
# Whitelist approach: ignore everything, then allow only what Docker builds need
|
||||
# This reduces build context from ~900MB to just what's required
|
||||
|
||||
# Ignore everything first
|
||||
*
|
||||
|
||||
# === n8n main image (docker/images/n8n/Dockerfile) ===
|
||||
!compiled
|
||||
!compiled/**
|
||||
!THIRD_PARTY_LICENSES.md
|
||||
|
||||
# === runners image (docker/images/runners/Dockerfile + Dockerfile.distroless) ===
|
||||
!dist
|
||||
!dist/task-runner-javascript
|
||||
!dist/task-runner-javascript/**
|
||||
!packages
|
||||
!packages/@n8n
|
||||
!packages/@n8n/task-runner-python
|
||||
!packages/@n8n/task-runner-python/**
|
||||
|
||||
# === Docker build files (entrypoints, configs) ===
|
||||
!docker
|
||||
!docker/images
|
||||
!docker/images/n8n
|
||||
!docker/images/n8n/docker-entrypoint.sh
|
||||
!docker/images/runners
|
||||
!docker/images/runners/n8n-task-runners.json
|
||||
|
|
@ -33,8 +33,7 @@ RUN echo "https://dl-cdn.alpinelinux.org/alpine/v3.22/main" >> /etc/apk/reposito
|
|||
# Install full-icu
|
||||
RUN npm install -g full-icu@1.5.0
|
||||
|
||||
RUN rm -rf /tmp/* /root/.npm /root/.cache/node /opt/yarn* && \
|
||||
apk del apk-tools
|
||||
RUN rm -rf /tmp/* /root/.npm /root/.cache/node
|
||||
|
||||
# ==============================================================================
|
||||
# STAGE 2: Final Base Runtime Image
|
||||
|
|
@ -43,6 +42,8 @@ FROM node:${NODE_VERSION}-alpine
|
|||
|
||||
COPY --from=builder / /
|
||||
|
||||
RUN rm -rf /opt/yarn* && apk del apk-tools
|
||||
|
||||
WORKDIR /home/node
|
||||
ENV NODE_ICU_DATA=/usr/local/lib/node_modules/full-icu
|
||||
EXPOSE 5678/tcp
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user