Skip to content

Commit

Permalink
Overwrite torch and torchvision versions for prod install
Browse files Browse the repository at this point in the history
  • Loading branch information
leihuayi committed Sep 19, 2023
1 parent bab8dfb commit c22c4a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
10 changes: 5 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ RUN apt update && apt install -y \
&& rm -rf /var/lib/apt/lists/*

# install python libraries (except torch)
COPY requirements/ requirements/
COPY requirements.txt .
ENV PIP_CERT=$CACERT_LOCATION
RUN pip --default-timeout=300 install --upgrade pip \
&& pip --default-timeout=300 install --no-cache-dir -r requirements/common.txt \
&& pip --default-timeout=300 install --no-cache-dir -r requirements.txt \
&& rm -r /root/.cache

ARG VERSION
Expand All @@ -31,14 +31,14 @@ RUN mkdir -p src/weights \

# launch website
FROM base as dev
RUN pip --default-timeout=300 install --no-cache-dir -r requirements/dev.txt
CMD ["uvicorn", "src.main:app", "--reload", "--host", "0.0.0.0", "--port", "5000"]

FROM base as test
RUN pip install -r requirements/dev.txt && pip install requests && rm -r /root/.cache
RUN pip install requests && rm -r /root/.cache
COPY tests/ tests/
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5000"]

FROM base as prod
RUN pip install --no-cache-dir -r requirements/prod.txt
RUN pip install --extra-index-url https://download.pytorch.org/whl/cpu \
torch==1.13.0+cpu torchvision==0.14.0+cpu && rm -r /root/.cache
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5000"]
5 changes: 4 additions & 1 deletion backend/requirements/common.txt → backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--extra-index-url https://download.pytorch.org/whl/cpu
fastapi==0.68.0
uvicorn==0.14.0
python-multipart>=0.0.5
Expand All @@ -6,4 +7,6 @@ pyyaml>=5.4.1
user-agents==2.2.0
ua-parser==0.10.0
python-openstackclient==5.8.0
python-swiftclient==4.0.0
python-swiftclient==4.0.0
torch==1.13.0
torchvision==0.14.0
3 changes: 0 additions & 3 deletions backend/requirements/dev.txt

This file was deleted.

3 changes: 0 additions & 3 deletions backend/requirements/prod.txt

This file was deleted.

0 comments on commit c22c4a0

Please sign in to comment.