Spaces:
Build error
Build error
lucianotonet
commited on
Commit
•
fc435ec
1
Parent(s):
4881151
Create Dockerfile
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:12.3.1-base-ubuntu22.04
|
2 |
+
|
3 |
+
ENV DEBIAN_FRONTEND noninteractive
|
4 |
+
ENV CMDARGS --listen
|
5 |
+
|
6 |
+
# Instalar dependências do sistema
|
7 |
+
RUN apt-get update -y && \
|
8 |
+
apt-get install -y curl libgl1 libglib2.0-0 git python3-pip && \
|
9 |
+
apt-get clean && \
|
10 |
+
rm -rf /var/lib/apt/lists/*
|
11 |
+
|
12 |
+
# Criar diretório de trabalho
|
13 |
+
WORKDIR /code
|
14 |
+
|
15 |
+
# Copiar e instalar requisitos Python
|
16 |
+
COPY . /code/
|
17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
+
RUN pip install --no-cache-dir xformers==0.0.23 --no-dependencies
|
19 |
+
|
20 |
+
# Configurar Gradio
|
21 |
+
RUN curl -fsL -o /usr/local/lib/python3.10/dist-packages/gradio/frpc_linux_amd64_v0.2 https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64 && \
|
22 |
+
chmod +x /usr/local/lib/python3.10/dist-packages/gradio/frpc_linux_amd64_v0.2
|
23 |
+
|
24 |
+
# Configurar diretórios e permissões
|
25 |
+
RUN adduser --disabled-password --gecos '' user && \
|
26 |
+
mkdir -p /content/app /content/data
|
27 |
+
COPY entrypoint.sh /content/
|
28 |
+
RUN chown -R user:user /content
|
29 |
+
|
30 |
+
# Executar como usuário não root
|
31 |
+
USER user
|
32 |
+
|
33 |
+
# Comando de inicialização
|
34 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|