mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix: Align release Docker image build with lockfile (no-changelog) (#14966)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
2
.github/workflows/docker-images-custom.yml
vendored
2
.github/workflows/docker-images-custom.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
||||
DOCKER_BUILD_SUMMARY: false
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/images/n8n-custom/Dockerfile
|
||||
file: ./docker/images/n8n/Dockerfile
|
||||
build-args: |
|
||||
N8N_RELEASE_TYPE=development
|
||||
platforms: linux/amd64
|
||||
|
||||
2
.github/workflows/docker-images-nightly.yml
vendored
2
.github/workflows/docker-images-nightly.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
DOCKER_BUILD_SUMMARY: false
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/images/n8n-custom/Dockerfile
|
||||
file: ./docker/images/n8n/Dockerfile
|
||||
build-args: |
|
||||
N8N_RELEASE_TYPE=nightly
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
6
.github/workflows/release-publish.yml
vendored
6
.github/workflows/release-publish.yml
vendored
@@ -106,9 +106,13 @@ jobs:
|
||||
env:
|
||||
DOCKER_BUILD_SUMMARY: false
|
||||
with:
|
||||
context: ./docker/images/n8n
|
||||
context: .
|
||||
file: docker/images/n8n/Dockerfile
|
||||
build-args: |
|
||||
N8N_VERSION=${{ needs.publish-to-npm.outputs.release }}
|
||||
N8N_RELEASE_TYPE=stable
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64,linux/arm64
|
||||
provenance: false
|
||||
push: true
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
ARG NODE_VERSION=20
|
||||
|
||||
# 1. Create an image to build n8n
|
||||
FROM --platform=linux/amd64 n8nio/base:${NODE_VERSION} AS builder
|
||||
|
||||
# Build the application from source
|
||||
WORKDIR /src
|
||||
COPY . /src
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store --mount=type=cache,id=pnpm-metadata,target=/root/.cache/pnpm/metadata DOCKER_BUILD=true pnpm install --frozen-lockfile
|
||||
RUN pnpm build
|
||||
|
||||
# Delete all dev dependencies
|
||||
RUN jq 'del(.pnpm.patchedDependencies)' package.json > package.json.tmp; mv package.json.tmp package.json
|
||||
RUN node .github/scripts/trim-fe-packageJson.js
|
||||
|
||||
# Delete any source code, source-mapping, or typings
|
||||
RUN find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm -rf
|
||||
|
||||
# Deploy the `n8n` package into /compiled
|
||||
RUN mkdir /compiled
|
||||
RUN NODE_ENV=production DOCKER_BUILD=true pnpm --filter=n8n --prod --no-optional --legacy deploy /compiled
|
||||
|
||||
# 2. Start with a new clean image with just the code that is needed to run n8n
|
||||
FROM n8nio/base:${NODE_VERSION}
|
||||
ENV NODE_ENV=production
|
||||
|
||||
ARG N8N_RELEASE_TYPE=dev
|
||||
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
|
||||
|
||||
WORKDIR /home/node
|
||||
COPY --from=builder /compiled /usr/local/lib/node_modules/n8n
|
||||
COPY docker/images/n8n/docker-entrypoint.sh /
|
||||
|
||||
# Setup the Task Runner Launcher
|
||||
ARG TARGETPLATFORM
|
||||
ARG LAUNCHER_VERSION=1.1.2
|
||||
COPY docker/images/n8n/n8n-task-runners.json /etc/n8n-task-runners.json
|
||||
# Download, verify, then extract the launcher binary
|
||||
RUN \
|
||||
if [[ "$TARGETPLATFORM" = "linux/amd64" ]]; then export ARCH_NAME="amd64"; \
|
||||
elif [[ "$TARGETPLATFORM" = "linux/arm64" ]]; then export ARCH_NAME="arm64"; fi; \
|
||||
mkdir /launcher-temp && \
|
||||
cd /launcher-temp && \
|
||||
wget https://github.com/n8n-io/task-runner-launcher/releases/download/${LAUNCHER_VERSION}/task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz && \
|
||||
wget https://github.com/n8n-io/task-runner-launcher/releases/download/${LAUNCHER_VERSION}/task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz.sha256 && \
|
||||
# The .sha256 does not contain the filename --> Form the correct checksum file
|
||||
echo "$(cat task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz.sha256) task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz" > checksum.sha256 && \
|
||||
sha256sum -c checksum.sha256 && \
|
||||
tar xvf task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz --directory=/usr/local/bin && \
|
||||
cd - && \
|
||||
rm -r /launcher-temp
|
||||
|
||||
RUN \
|
||||
cd /usr/local/lib/node_modules/n8n && \
|
||||
npm rebuild sqlite3 && \
|
||||
cd - && \
|
||||
ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
|
||||
mkdir .n8n && \
|
||||
chown node:node .n8n
|
||||
|
||||
ENV SHELL /bin/sh
|
||||
USER node
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
@@ -1,12 +0,0 @@
|
||||
# n8n - Custom Image
|
||||
|
||||
Dockerfile which allows to package up the local n8n code into
|
||||
a docker image.
|
||||
|
||||
## Usage
|
||||
|
||||
Execute the following in the n8n root folder:
|
||||
|
||||
```bash
|
||||
docker build -t n8n-custom -f docker/images/n8n-custom/Dockerfile .
|
||||
```
|
||||
@@ -1,8 +1,32 @@
|
||||
ARG NODE_VERSION=20
|
||||
FROM n8nio/base:${NODE_VERSION}
|
||||
ARG N8N_VERSION=snapshot
|
||||
|
||||
ARG N8N_VERSION
|
||||
RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi
|
||||
# 1. Create an image to build n8n
|
||||
FROM --platform=linux/amd64 n8nio/base:${NODE_VERSION} AS builder
|
||||
|
||||
# Build the application from source
|
||||
WORKDIR /src
|
||||
COPY . /src
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store --mount=type=cache,id=pnpm-metadata,target=/root/.cache/pnpm/metadata DOCKER_BUILD=true pnpm install --frozen-lockfile
|
||||
RUN pnpm build
|
||||
|
||||
# Delete all dev dependencies
|
||||
RUN jq 'del(.pnpm.patchedDependencies)' package.json > package.json.tmp; mv package.json.tmp package.json
|
||||
RUN node .github/scripts/trim-fe-packageJson.js
|
||||
|
||||
# Delete any source code or typings
|
||||
RUN find . -type f -name "*.ts" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm -rf
|
||||
|
||||
# Deploy the `n8n` package into /compiled
|
||||
RUN mkdir /compiled
|
||||
RUN NODE_ENV=production DOCKER_BUILD=true pnpm --filter=n8n --prod --no-optional --legacy deploy /compiled
|
||||
|
||||
# 2. Start with a new clean image with just the code that is needed to run n8n
|
||||
FROM n8nio/base:${NODE_VERSION}
|
||||
ENV NODE_ENV=production
|
||||
|
||||
ARG N8N_RELEASE_TYPE=dev
|
||||
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
|
||||
|
||||
LABEL org.opencontainers.image.title="n8n"
|
||||
LABEL org.opencontainers.image.description="Workflow Automation Tool"
|
||||
@@ -10,22 +34,14 @@ LABEL org.opencontainers.image.source="https://github.com/n8n-io/n8n"
|
||||
LABEL org.opencontainers.image.url="https://n8n.io"
|
||||
LABEL org.opencontainers.image.version=${N8N_VERSION}
|
||||
|
||||
ENV N8N_VERSION=${N8N_VERSION}
|
||||
ENV NODE_ENV=production
|
||||
ENV N8N_RELEASE_TYPE=stable
|
||||
RUN set -eux; \
|
||||
npm install -g --omit=dev n8n@${N8N_VERSION} --ignore-scripts && \
|
||||
npm rebuild --prefix=/usr/local/lib/node_modules/n8n sqlite3 && \
|
||||
rm -rf /usr/local/lib/node_modules/n8n/node_modules/@n8n/chat && \
|
||||
rm -rf /usr/local/lib/node_modules/n8n/node_modules/@n8n/design-system && \
|
||||
rm -rf /usr/local/lib/node_modules/n8n/node_modules/n8n-editor-ui/node_modules && \
|
||||
find /usr/local/lib/node_modules/n8n -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" | xargs rm -f && \
|
||||
rm -rf /root/.npm
|
||||
WORKDIR /home/node
|
||||
COPY --from=builder /compiled /usr/local/lib/node_modules/n8n
|
||||
COPY docker/images/n8n/docker-entrypoint.sh /
|
||||
|
||||
# Setup the Task Runner Launcher
|
||||
ARG TARGETPLATFORM
|
||||
ARG LAUNCHER_VERSION=1.1.2
|
||||
COPY n8n-task-runners.json /etc/n8n-task-runners.json
|
||||
COPY docker/images/n8n/n8n-task-runners.json /etc/n8n-task-runners.json
|
||||
# Download, verify, then extract the launcher binary
|
||||
RUN \
|
||||
if [[ "$TARGETPLATFORM" = "linux/amd64" ]]; then export ARCH_NAME="amd64"; \
|
||||
@@ -41,11 +57,14 @@ RUN \
|
||||
cd - && \
|
||||
rm -r /launcher-temp
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
|
||||
RUN \
|
||||
cd /usr/local/lib/node_modules/n8n && \
|
||||
npm rebuild sqlite3 && \
|
||||
cd - && \
|
||||
ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
|
||||
mkdir .n8n && \
|
||||
chown node:node .n8n
|
||||
|
||||
ENV SHELL /bin/sh
|
||||
USER node
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
|
||||
@@ -132,7 +132,7 @@ export class ErrorReporter {
|
||||
beforeSend: this.beforeSend.bind(this) as NodeOptions['beforeSend'],
|
||||
integrations: (integrations) => [
|
||||
...integrations.filter(({ name }) => enabledIntegrations.includes(name)),
|
||||
rewriteFramesIntegration({ root: process.cwd() }),
|
||||
rewriteFramesIntegration({ root: '/' }),
|
||||
requestDataIntegration({
|
||||
include: {
|
||||
cookies: false,
|
||||
|
||||
Reference in New Issue
Block a user