Skip to content

Commit 656b1c6

Browse files
authored
Merge pull request #35 from deepnote/ach/optimization
Test optimise size of datasicence image
2 parents 0b22cd2 + de04017 commit 656b1c6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

python/datascience/Dockerfile.datascience

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ ARG FROM_PYTHON_VERSION
1515
RUN python -m pip install --upgrade setuptools pip
1616

1717
RUN if [ "$(printf '%s\n' "$FROM_PYTHON_VERSION" "3.11" | sort -V | head -n1)" = "3.11" ]; then \
18-
pip install -r requirements-3.11+.txt -c constraints.txt\
18+
mv "requirements-3.11+.txt" "requirements.txt" \
1919
; else \
20-
pip install -r requirements-below-3.11.txt -c constraints.txt\
20+
mv "requirements-below-3.11.txt" "requirements.txt" \
2121
; fi
2222

23-
24-
# Clean up the requirements files from the image
25-
RUN rm /requirements-3.11+.txt /requirements-below-3.11.txt
23+
# Install dependencies
24+
# Combine all RUN commands into one to minimize the number of layers
25+
RUN apt-get update \
26+
&& apt-get install -y --no-install-recommends gcc \
27+
&& pip install --no-cache-dir -r requirements.txt -c constraints.txt \
28+
&& apt-get purge -y gcc \
29+
&& apt-get autoremove -y \
30+
&& apt-get clean \
31+
&& rm -rf /var/lib/apt/lists/* /root/.cache

0 commit comments

Comments
 (0)