44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
# Use the official Node.js development container as base
|
|
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye
|
|
|
|
# Set the working directory
|
|
WORKDIR /workspaces
|
|
|
|
# Install additional system dependencies that might be needed for n8n
|
|
RUN apt-get update && apt-get install -y \
|
|
python3 \
|
|
python3-pip \
|
|
build-essential \
|
|
curl \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Switch to node user for security
|
|
USER node
|
|
|
|
# Set up npm configuration for the node user
|
|
RUN npm config set prefix '/home/node/.npm-global'
|
|
ENV PATH=/home/node/.npm-global/bin:$PATH
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /home/node/.n8n \
|
|
&& mkdir -p /home/node/.npm-global
|
|
|
|
# Pre-install some global packages to speed up container startup
|
|
RUN npm install -g npm@latest typescript ts-node nodemon
|
|
|
|
# Set the default shell to bash for better development experience
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
# Expose the default n8n port
|
|
EXPOSE 5678
|
|
|
|
# Set environment variables for n8n
|
|
ENV N8N_HOST=0.0.0.0
|
|
ENV N8N_PORT=5678
|
|
ENV N8N_PROTOCOL=http
|
|
ENV NODE_ENV=development
|
|
|
|
# Set the default command
|
|
CMD ["bash"]
|