Spaces:
Runtime error
Runtime error
File size: 1,731 Bytes
869d71f dd55fa1 869d71f 05b84e9 869d71f 05b84e9 869d71f 05b84e9 dd55fa1 869d71f 09f87be |
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 |
FROM postgres:15
# Install utilities
RUN apt-get update && apt-get install -y \
wget \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install pgweb
RUN wget https://github.com/sosedoff/pgweb/releases/download/v0.14.1/pgweb_linux_amd64.zip \
&& unzip pgweb_linux_amd64.zip \
&& mv pgweb_linux_amd64 /usr/local/bin/pgweb \
&& rm pgweb_linux_amd64.zip
# Create a directory for the custom start script
WORKDIR /app
# Copy the start script
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
# Set the user to postgres (UID 999) which is the default for this image
# However, HF Spaces runs as UID 1000.
# We need to ensure permissions are correct for /var/lib/postgresql/data
# The official image creates a volume at /var/lib/postgresql/data
# We will let the start script handle the user switching or just run as the default user if possible.
# HF Spaces overrides the user to 1000.
# We need to make sure the data directory is writable by UID 1000.
# Install Node.js and n8n
RUN apt-get update && apt-get install -y \
curl \
gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g n8n \
&& rm -rf /var/lib/apt/lists/*
# Create the data directory and give permissions to UID 1000
# We create a user with UID 1000 to match HF Spaces default and avoid root errors
RUN useradd -m -u 1000 hf_user
RUN mkdir -p /var/lib/postgresql/data && \
chown -R hf_user:hf_user /var/lib/postgresql/data && \
chmod 700 /var/lib/postgresql/data
# Switch to the non-root user
USER hf_user
# Expose the port for n8n (HF Spaces expects 7860)
EXPOSE 7860
# Set the entrypoint to our custom script
CMD ["/app/start.sh"] .........
|