elsamueldev commited on
Commit
3487048
·
1 Parent(s): b4804a9

Agregar Dockerfile, archivo de inicialización y requisitos para la configuración del entorno

Browse files
Files changed (4) hide show
  1. .dockerignore +1 -0
  2. Dockerfile +24 -0
  3. init.py +13 -0
  4. requirements.txt +6 -0
.dockerignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .venv/
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.11
5
+
6
+ # add user to avoid some library problems
7
+ RUN useradd -m -u 1000 user
8
+ USER user
9
+ ENV PATH="/home/user/.local/bin:$PATH"
10
+
11
+ WORKDIR /app
12
+
13
+ # copy requirements and download them
14
+ COPY --chown=user ./requirements.txt requirements.txt
15
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
16
+
17
+ # copy repo files
18
+ COPY --chown=user . /app
19
+
20
+ # run initialization script that downloads the code
21
+ RUN python init.py
22
+
23
+ # run the main script
24
+ CMD ["python", "main.py"]
init.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from huggingface_hub import login, snapshot_download
4
+
5
+ CODE_REPO_ID = "elsamueldev/confia-backend-code"
6
+
7
+ login(os.getenv("HF_TOKEN"))
8
+
9
+ snapshot_download(
10
+ CODE_REPO_ID,
11
+ local_dir=".",
12
+ local_dir_use_symlinks=False
13
+ )
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ fastapi==0.115.8
2
+ uvicorn==0.34.0
3
+ huggingface-hub==0.27.1
4
+ tensorflow==2.18.0
5
+ keras==3.8.0
6
+ python-dotenv==1.0.1