arpy8 commited on
Commit
b618776
·
1 Parent(s): e90a64d

refactor: optimize Dockerfile for virtual environment setup and streamline package installation

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -12
Dockerfile CHANGED
@@ -2,22 +2,15 @@ FROM python:3.11.10
2
 
3
  WORKDIR /code
4
 
5
- RUN pip install uv
6
-
7
- ENV VIRTUAL_ENV=/code/venv
8
  RUN uv venv $VIRTUAL_ENV
9
  ENV PATH="$VIRTUAL_ENV/bin:$PATH"
10
 
11
- COPY . .
12
-
13
- RUN --mount=type=secret,id=MONGO_STRING \
14
- --mount=type=secret,id=API_KEY \
15
- --mount=type=secret,id=NEWS_API_KEY \
16
- export MONGO_STRING=$(cat /run/secrets/MONGO_STRING) && \
17
- export NEWS_API_KEY=$(cat /run/secrets/NEWS_API_KEY) && \
18
- export API_KEY=$(cat /run/secrets/API_KEY)
19
 
20
- RUN uv pip install --no-cache --system -r /code/requirements.txt
21
 
22
  ENV PORT=7860
23
  EXPOSE $PORT
 
2
 
3
  WORKDIR /code
4
 
5
+ RUN pip install --no-cache-dir uv
6
+ ENV VIRTUAL_ENV=/code/.venv
 
7
  RUN uv venv $VIRTUAL_ENV
8
  ENV PATH="$VIRTUAL_ENV/bin:$PATH"
9
 
10
+ COPY requirements.txt .
11
+ RUN uv pip install --no-cache -r requirements.txt
 
 
 
 
 
 
12
 
13
+ COPY . .
14
 
15
  ENV PORT=7860
16
  EXPOSE $PORT