File size: 2,651 Bytes
bbc24a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61dee20
 
 
7540773
61dee20
 
bbc24a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Use a base image with systemd or a process manager if complex, otherwise a simpler base
# Ubuntu is a good general-purpose choice for installing multiple services
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

# Install dependencies: curl, wget, gnupg, sudo, procps (for ps), net-tools (for netstat)
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    gnupg \
    sudo \
    procps \
    net-tools \
    ca-certificates \
    postgresql \
    postgresql-contrib \
    zstd \
    && rm -rf /var/lib/apt/lists/*

# --- Install Node.js (e.g., v20.x LTS) ---
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

RUN node -v
RUN npm -v

# Install n8n
RUN npm install -g n8n

# Install Qdrant
ARG QDRANT_VERSION=v1.9.2
RUN wget "https://github.com/qdrant/qdrant/releases/download/${QDRANT_VERSION}/qdrant-x86_64-unknown-linux-gnu.tar.gz" -O qdrant.tar.gz && \
    tar -xzf qdrant.tar.gz && \
    mv qdrant /usr/local/bin/qdrant && \
    rm qdrant.tar.gz && \
    mkdir -p /qdrant/storage && \
    mkdir -p /qdrant/config
COPY qdrant_config.yaml /qdrant/config/config.yaml

# Install Ollama
RUN curl -fsSL https://ollama.com/install.sh | sh

# Create a non-root user for n8n and other services if possible
RUN useradd -m -s /bin/bash n8nuser
RUN mkdir -p /home/n8nuser/.n8n /data/shared /home/n8nuser/.ollama /var/run/postgresql
RUN chown -R n8nuser:n8nuser /home/n8nuser /data/shared /qdrant /var/run/postgresql


# Setup environment variables
# IMPORTANT: NO end-of-line comments in this ENV block
ENV N8N_HOST="0.0.0.0"
ENV N8N_PORT="5678"
ENV NODE_ENV="production"
ENV DB_TYPE="postgresdb"
ENV DB_POSTGRESDB_HOST="localhost"
ENV DB_POSTGRESDB_PORT="5432"
ENV DB_POSTGRESDB_DATABASE="n8n"
ENV DB_POSTGRESDB_USER="n8n"
ENV OLLAMA_HOST="0.0.0.0:11434"
# OAuth redirect URL configuration - override with proxy base URL
ENV N8N_EDITOR_BASE_URL="https://n8n-clickup-oauth-proxy.vercel.app/"
ENV N8N_WEBHOOK_URL="https://n8n-clickup-oauth-proxy.vercel.app/"
ENV N8N_PUBLIC_WEBHOOK_URL="https://n8n-clickup-oauth-proxy.vercel.app/"
ENV WEBHOOK_URL="https://n8n-clickup-oauth-proxy.vercel.app/"
ENV N8N_SEC_EMBEDDER_HEADER_ALLOW_FROM_REGEX="^https?:\\/\\/([a-zA-Z0-9\\-]+\\.)*hf\\.space$"
ENV N8N_SEC_ALLOW_ALL_ORIGINS_FOR_WEBHOOKS="true"
ENV N8N_RUNNERS_ENABLED="true"

# Copy startup script
COPY start.sh /start.sh
RUN chmod +x /start.sh

# Expose n8n port
EXPOSE 5678
EXPOSE 11434
EXPOSE 6333
EXPOSE 5432

RUN mkdir -p /data/.n8n /data/postgres /data/qdrant_storage /data/.ollama && chown -R n8nuser:n8nuser /data
USER n8nuser
ENTRYPOINT ["/start.sh"]