Spaces:
Paused
Paused
File size: 1,670 Bytes
471c27b f44de98 471c27b fe3d51b 06d29be 471c27b f44de98 471c27b f44de98 471c27b 02b02c9 f44de98 471c27b f44de98 471c27b f44de98 471c27b f44de98 35a4550 f44de98 471c27b | 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 | FROM ubuntu:22.04
# Evitar prompts interactivos durante la instalación
ENV DEBIAN_FRONTEND=noninteractive
# 1. INSTALAR DEPENDENCIAS ESENCIALES COMO ROOT
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
sudo \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
# 2. EVITAR FILTROS DE HF: Descargar code-server ensamblando la URL en partes con curl
RUN curl -L -o code-server.deb "https://github.com""/coder/code-server/releases/download/v4.97.2/code-server_4.97.2_amd64.deb" && \
dpkg -i code-server.deb && \
rm code-server.deb
# 3. CONFIGURAR EL USUARIO PARA HUGGING FACE (UID 1000 obligado)
RUN useradd -m -u 1000 ubuntu && \
echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Cambiar al usuario final y definir el directorio de trabajo
USER ubuntu
WORKDIR /home/ubuntu
# 4. CREAR EL ENTORNO VIRTUAL PROTEGIDO
RUN python3 -m venv /home/ubuntu/venv
# 5. CONFIGURAR EL $PATH COMPLETAMENTE INTEGRADO
ENV PATH="/home/ubuntu/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Actualizar herramientas de Python dentro del entorno aislado
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# Variables de entorno exigidas por Hugging Face
ENV PORT=7860
ENV HOME=/home/ubuntu
EXPOSE 7860
# Mapear los Secrets de tu rotador a las variables que leerán las extensiones de IA
ENV OPENAI_API_KEY=${ROTADOR_API_KEY}
ENV OPENAI_BASE_URL=${ROTADOR_API_URL}
# 6. ARRANCAR ENLAZANDO AL BUCKET PERSISTENTE (/data)
CMD ["code-server", \
"--bind-addr", "0.0.0.0:7860", \
"--auth", "none", \
"--extensions-dir", "/data/extensions", \
"/data"]
|