ArthurGamaJorge commited on
Commit
9965747
·
1 Parent(s): 0d8539a

Testar build hugging face

Browse files
Files changed (2) hide show
  1. Dockerfile +8 -10
  2. api/__init__.py +1 -0
Dockerfile CHANGED
@@ -1,18 +1,16 @@
1
- FROM python:3.9
2
 
3
- RUN useradd -m -u 1000 user
4
- ENV PATH="/home/user/.local/bin:$PATH"
5
 
6
  WORKDIR /app
7
 
8
- COPY ./requirements.txt /app/requirements.txt
9
- RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
10
 
11
- COPY . /app
12
- RUN chown -R user:user /app
13
-
14
- USER user
15
 
 
 
16
  EXPOSE 8000
17
 
18
- CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ FROM python:3.11-slim
2
 
3
+ ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
 
4
 
5
  WORKDIR /app
6
 
7
+ COPY requirements.txt ./
8
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
9
 
10
+ COPY . .
 
 
 
11
 
12
+ # Hugging Face Spaces injects $PORT. Fall back to 8000 if not set (local dev)
13
+ ENV PORT=${PORT:-8000}
14
  EXPOSE 8000
15
 
16
+ CMD ["bash", "-c", "uvicorn api.app:app --host 0.0.0.0 --port $PORT"]
api/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # Makes the api directory a package so 'api.app:app' works as a module path.