docs4you commited on
Commit
f64ca43
verified
1 Parent(s): 0eba6a1

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +58 -0
Dockerfile ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ARG PORT=7860
2
+ ARG PROXY_CONTENT=TRUE
3
+ ARG SOCKS5
4
+ ARG API_URL="https://your-space-url.hf.space"
5
+
6
+ FROM python:3.13 AS builder
7
+
8
+ RUN apt-get update && apt-get install -y git curl unzip util-linux procps gnupg ca-certificates
9
+
10
+ # Crear usuario y grupo con UID/GID 1000
11
+ RUN groupadd -g 1000 appuser && useradd -u 1000 -g 1000 -m appuser
12
+
13
+ # Clonar el repositorio como usuario appuser
14
+ USER appuser
15
+ WORKDIR /app
16
+ RUN git clone https://github.com/gookie-dev/StepDaddyLiveHD.git . --depth 1
17
+
18
+ # Crear entorno virtual
19
+ RUN python -m venv /home/appuser/venv
20
+ ENV PATH="/home/appuser/venv/bin:$PATH"
21
+
22
+ # Instalar dependencias
23
+ RUN pip install --upgrade pip && pip install -r requirements.txt
24
+
25
+ ARG PORT API_URL PROXY_CONTENT SOCKS5
26
+
27
+ # Crear directorio para archivos est谩ticos y ejecutar reflex export
28
+ RUN mkdir -p /tmp/static \
29
+ && API_URL=${API_URL:-http://localhost:$PORT} reflex export --loglevel debug --frontend-only --no-zip \
30
+ && mv .web/_static/* /tmp/static/ \
31
+ && rm -rf .web
32
+
33
+ FROM python:3.13-slim
34
+
35
+ RUN apt-get update -y && apt-get install -y caddy redis-server && rm -rf /var/lib/apt/lists/*
36
+
37
+ ARG PORT API_URL
38
+ ENV PATH="/home/appuser/venv/bin:$PATH" \
39
+ PORT=$PORT \
40
+ API_URL=${API_URL:-http://localhost:$PORT} \
41
+ REDIS_URL=redis://localhost \
42
+ PYTHONUNBUFFERED=1 \
43
+ PROXY_CONTENT=${PROXY_CONTENT:-TRUE} \
44
+ SOCKS5=${SOCKS5:-""}
45
+
46
+ # Usar el mismo UID/GID que en la etapa de construcci贸n
47
+ USER 1000:1000
48
+ WORKDIR /app
49
+
50
+ # Copiar desde el stage builder
51
+ COPY --from=builder --chown=1000:1000 /home/appuser/venv /home/appuser/venv
52
+ COPY --from=builder --chown=1000:1000 /app /app
53
+ COPY --from=builder --chown=1000:1000 /tmp/static /srv
54
+
55
+ # Iniciar servicios
56
+ CMD caddy start && \
57
+ redis-server --daemonize yes && \
58
+ exec reflex run --env prod --backend-only