Skip to content

Commit bec242d

Browse files
Add first docker and docker-compose support
1 parent c1320ac commit bec242d

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GENERIC_TIMEZONE=UTC

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM docker.n8n.io/n8nio/n8n:latest AS target
2+
3+
FROM node:19-alpine AS build
4+
RUN npm i npm@latest -g
5+
WORKDIR /build
6+
COPY . .
7+
8+
RUN npm run build
9+
10+
FROM target as final
11+
WORKDIR /custom-nodes
12+
13+
COPY --from=build /build .
14+
COPY --from=build /build/run.sh /run.sh
15+
16+
WORKDIR /custom-nodes
17+
USER root
18+
RUN npm link
19+
20+
USER node
21+
ENTRYPOINT [ "tini", "--", "/run.sh" ]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ These are the basic steps for working with the starter. For detailed guidance on
3131
3. Run `npm i` to install dependencies.
3232
4. Open the project in your editor.
3333
5. Browse the examples in `/nodes` and `/credentials`. Modify the examples, or replace them with your own nodes.
34-
6. Update the `package.json` to match your details.
34+
6. Update the `package.json` to match your details. Also update the `run.sh` with your package (In `package.json` => "name") name.
3535
7. Run `npm run lint` to check for errors or `npm run lintfix` to automatically fix errors when possible.
3636
8. Test your node locally. Refer to [Run your node locally](https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally/) for guidance.
3737
9. Replace this README with documentation for your node. Use the [README_TEMPLATE](README_TEMPLATE.md) to get started.

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: "3"
2+
3+
services:
4+
n8n:
5+
image: n8n-custom-nodes
6+
restart: unless-stopped
7+
build: .
8+
ports:
9+
- "5678:5678"
10+
environment:
11+
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
12+
- N8N_LOG_LEVEL=debug
13+
volumes:
14+
- n8n-data:/home/node/.n8n
15+
16+
volumes:
17+
n8n-data:
18+
name: n8n-data

run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
mkdir -p ~/.n8n/nodes/
3+
cd ~/.n8n/nodes/
4+
npm link n8n-nodes-<...>
5+
/docker-entrypoint.sh

0 commit comments

Comments
 (0)