barathm2001 commited on
Commit
447816d
·
verified ·
1 Parent(s): f5e4c93

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -6
Dockerfile CHANGED
@@ -1,24 +1,33 @@
1
- FROM python:3.10 as builder
 
 
 
 
 
 
2
 
3
  WORKDIR /code
4
 
 
5
  COPY ./requirements.txt /code/requirements.txt
6
 
 
7
  RUN pip install --no-cache-dir --upgrade pip && \
8
  pip install --no-cache-dir -r /code/requirements.txt
9
 
10
- FROM python:3.10-slim
11
-
12
  RUN useradd -m user
13
  USER user
14
 
 
15
  ENV HOME=/home/user \
16
- PATH=/home/user/.local/bin:${PATH} \
17
  PYTHONUNBUFFERED=1
18
 
19
  WORKDIR $HOME/app
20
 
21
- COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
22
  COPY --chown=user . $HOME/app
23
 
24
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ build-essential \
6
+ git \
7
+ && rm -rf /var/lib/apt/lists/*
8
 
9
  WORKDIR /code
10
 
11
+ # Copy requirements file
12
  COPY ./requirements.txt /code/requirements.txt
13
 
14
+ # Upgrade pip and install requirements
15
  RUN pip install --no-cache-dir --upgrade pip && \
16
  pip install --no-cache-dir -r /code/requirements.txt
17
 
18
+ # Create and use non-root user
 
19
  RUN useradd -m user
20
  USER user
21
 
22
+ # Set environment variables
23
  ENV HOME=/home/user \
24
+ PATH=/home/user/.local/bin:$PATH \
25
  PYTHONUNBUFFERED=1
26
 
27
  WORKDIR $HOME/app
28
 
29
+ # Copy application code
30
  COPY --chown=user . $HOME/app
31
 
32
+ # Run the application
33
+ CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]