Spaces:
Runtime error
Runtime error
File size: 2,096 Bytes
62ddfe8 b726952 947fb35 62ddfe8 b726952 62ddfe8 44b97b1 62ddfe8 53b6dc4 62ddfe8 53b6dc4 44b97b1 62ddfe8 44b97b1 62ddfe8 b726952 62ddfe8 b726952 62ddfe8 | 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 | FROM buildpack-deps:22.04-curl
# Non-interactive installs and timezone
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Asia/Kolkata \
N8N_EDITOR_BASE_URL="https://kumar-aditya-n8n.hf.space" \
WEBHOOK_URL="https://kumar-aditya-n8n.hf.space/" \
N8N_PORT=7860 \
N8N_HOST=0.0.0.0
# Define n8n environment variables
ENV N8N_HOME=/home/n8n/.n8n
ENV NODE_ENV=production
# Mount secrets for PostgreSQL credentials
RUN --mount=type=secret,id=DB_TYPE,required=true \
--mount=type=secret,id=DB_POSTGRESDB_DATABASE,required=true \
--mount=type=secret,id=DB_POSTGRESDB_HOST,required=true \
--mount=type=secret,id=DB_POSTGRESDB_PORT,required=true \
--mount=type=secret,id=DB_POSTGRESDB_USER,required=true \
--mount=type=secret,id=DB_POSTGRESDB_PASSWORD,required=true \
--mount=type=secret,id=DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED,required=true \
export DB_TYPE=$(cat /run/secrets/DB_TYPE) && \
export DB_POSTGRESDB_DATABASE=$(cat /run/secrets/DB_POSTGRESDB_DATABASE) && \
export DB_POSTGRESDB_HOST=$(cat /run/secrets/DB_POSTGRESDB_HOST) && \
export DB_POSTGRESDB_PORT=$(cat /run/secrets/DB_POSTGRESDB_PORT) && \
export DB_POSTGRESDB_USER=$(cat /run/secrets/DB_POSTGRESDB_USER) && \
export DB_POSTGRESDB_PASSWORD=$(cat /run/secrets/DB_POSTGRESDB_PASSWORD) && \
export DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED=$(cat /run/secrets/DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED) && \
echo "DB setup complete"
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
python3 \
python3-pip \
postgresql-client \
build-essential \
libssl-dev \
libnss3 \
libasound2 \
libxss1 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 20.x and n8n
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
npm install -g n8n@1.89.2
# Create n8n user and home
RUN useradd -m -u 1000 n8n
USER n8n
WORKDIR /home/n8n
# Hugging Face Spaces uses port 7860
EXPOSE 7860
# Start n8n
CMD ["n8n", "start"] |