Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit 3cd7072

Browse files
committed
Reduce docker image size by building without GPU
1 parent 28459d1 commit 3cd7072

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/run_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
- name: checkout repo
2828
uses: actions/checkout@v2
2929

30-
3130
- name: Cache MedMen Model
3231
id: cache-medmen
3332
uses: actions/cache@v4
3433
with:
3534
path: models/medmen
3635
key: medmen-${{ hashFiles('scripts/download_medmen.sh') }}
36+
3737
- name: Install Python 3
3838
uses: actions/setup-python@v5
3939
with:

Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
55
# Set the python path and preapre the base layer
66
WORKDIR /cat
77
COPY ./requirements.txt /cat
8-
RUN pip install --upgrade pip
98

10-
# Install requirements for the app
11-
RUN pip3 install --no-cache-dir -r requirements.txt
9+
# Install Python dependencies
10+
ARG USE_CPU_TORCH=false
11+
# NOTE: Allow building without GPU so as to lower image size (disabled by default)
12+
RUN pip install -U pip && \
13+
if [ "${USE_CPU_TORCH}" = "true" ]; then \
14+
pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu/; \
15+
else \
16+
pip install --no-cache-dir -r requirements.txt; \
17+
fi
1218

1319
# Get the spacy model
1420
ARG SPACY_MODELS="en_core_web_sm en_core_web_md en_core_web_lg"

0 commit comments

Comments
 (0)