File size: 2,507 Bytes
6415621
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Dockerfile for running Penpot on Hugging Face Spaces
# WARNING: This is NOT an official Penpot deployment method
# Hugging Face Spaces does NOT support Docker-in-Docker or multi-container setups well
# This is a SIMPLIFIED single-container approach with significant limitations

# For production use, please use the official docker-compose setup from:
# https://raw.githubusercontent.com/penpot/penpot/main/docker/images/docker-compose.yaml

FROM penpotapp/frontend:latest

# Switch to root to install dependencies
USER root

# Install system dependencies
RUN apt-get update && apt-get install -y \
    postgresql-15 \
    supervisor \
    wget \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Setup PostgreSQL
RUN mkdir -p /var/lib/postgresql/data && \
    chown -R postgres:postgres /var/lib/postgresql && \
    su - postgres -c "/usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/data"

# Create assets directory
RUN mkdir -p /opt/data/assets && chmod -R 755 /opt/data

# Environment variables for Penpot
ENV PENPOT_FLAGS="disable-email-verification enable-prepl-server disable-secure-session-cookies demo-users registration login-with-password" \
    PENPOT_PUBLIC_URI="http://0.0.0.0:7860" \
    PENPOT_DATABASE_URI="postgresql://localhost/penpot" \
    PENPOT_DATABASE_USERNAME="penpot" \
    PENPOT_DATABASE_PASSWORD="penpot" \
    PENPOT_SECRET_KEY="change-this-for-production-use-random-key" \
    PENPOT_HTTP_SERVER_HOST="0.0.0.0" \
    PENPOT_HTTP_SERVER_PORT="7860"

# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860

# Create startup script
RUN echo '#!/bin/bash\n\
set -e\n\
\n\
echo "Starting PostgreSQL..."\n\
su - postgres -c "/usr/lib/postgresql/15/bin/pg_ctl -D /var/lib/postgresql/data -l /var/log/postgresql.log start"\n\
sleep 5\n\
\n\
echo "Creating database..."\n\
su - postgres -c "psql -c \"CREATE DATABASE penpot;\"" || true\n\
su - postgres -c "psql -c \"CREATE USER penpot WITH PASSWORD '\''penpot'\'';\"" || true\n\
su - postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE penpot TO penpot;\"" || true\n\
\n\
echo "Starting Penpot..."\n\
exec /opt/run.sh\n\
' > /start.sh && chmod +x /start.sh

CMD ["/start.sh"]

# IMPORTANT NOTES:
# 1. This Dockerfile is NOT suitable for production use
# 2. Hugging Face Spaces may not support this complex setup
# 3. For proper deployment, use docker-compose with the official setup
# 4. This lacks Redis/Valkey, proper backend service, and exporter service
# 5. Consider using Elestio or dedicated hosting instead