AurelioAguirre commited on
Commit
a2b3d9e
·
1 Parent(s): cdba123

New Docker

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -13
Dockerfile CHANGED
@@ -1,20 +1,32 @@
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.10
 
 
 
 
 
 
5
 
6
- # The two following lines are requirements for the Dev Mode to be functional
7
- # Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
8
  RUN useradd -m -u 1000 user
9
- WORKDIR /app
 
10
 
11
- COPY --chown=user ./requirements.txt requirements.txt
12
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
- COPY --chown=user . /app
15
- COPY --chown=user main $HOME/app/main
 
 
 
16
 
17
- # Expose the port your application runs on.
18
- EXPOSE 7680
19
 
20
- CMD ["python", "-m", "main.app"]
 
 
 
 
 
1
+ FROM python:3.10-slim
 
2
 
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ bash \
6
+ wget \
7
+ git \
8
+ git-lfs \
9
+ && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Set up user properly
 
12
  RUN useradd -m -u 1000 user
13
+ ENV HOME=/home/user \
14
+ PATH=/home/user/.local/bin:$PATH
15
 
16
+ # Set working directory in user's home
17
+ WORKDIR $HOME/app
18
 
19
+ # Copy requirements and install as user
20
+ COPY --chown=user requirements.txt .
21
+ USER user
22
+ RUN pip install --no-cache-dir --upgrade pip && \
23
+ pip install --no-cache-dir -r requirements.txt
24
 
25
+ # Copy application code
26
+ COPY --chown=user . $HOME/app
27
 
28
+ # Make sure port matches the one in your code
29
+ EXPOSE 8001
30
+
31
+ # Use uvicorn directly with specific settings
32
+ CMD ["uvicorn", "main.app:app", "--host", "0.0.0.0", "--port", "8001", "--workers", "1", "--reload", "false"]