heboya8 commited on
Commit
04f4e10
·
verified ·
1 Parent(s): 6ba87e7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -13
Dockerfile CHANGED
@@ -1,20 +1,19 @@
1
- FROM python:3.11-slim
2
-
3
- WORKDIR /code
4
-
5
- COPY ./requirements.txt /code/requirements.txt
6
-
7
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
 
9
  RUN useradd -m -u 1000 user
10
-
11
  USER user
 
12
 
13
- ENV HOME=/home/user \
14
- PATH=/home/user/.local/bin:$PATH
15
 
16
- WORKDIR $HOME/app
 
 
17
 
18
- COPY --chown=user . $HOME/app
 
19
 
20
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ FROM python:3.9-slim
 
 
 
 
 
 
2
 
3
+ # Create non-root user
4
  RUN useradd -m -u 1000 user
 
5
  USER user
6
+ ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
+ # Set working directory
9
+ WORKDIR /app
10
 
11
+ # Install dependencies
12
+ COPY --chown=user ./requirements.txt requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
15
+ # Copy application files
16
+ COPY --chown=user . /app
17
 
18
+ # Run with gunicorn and uvicorn workers
19
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--worker-class", "uvicorn.workers.UvicornWorker", "main:app"]