Skip to content

Commit bf775ec

Browse files
committed
Trimmed down Dockerfile by removing caches
1 parent 88437e4 commit bf775ec

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ FROM python:3.8.7-alpine3.12
2323
# Build-time flags
2424
ARG WITH_PLUGINS=true
2525

26-
# Packages directory
26+
# Environment variables
2727
ENV PACKAGES=/usr/local/lib/python3.8/site-packages
28+
ENV PYTHONDONTWRITEBYTECODE=1
2829

2930
# Set build directory
3031
WORKDIR /tmp
@@ -37,7 +38,7 @@ COPY README.md README.md
3738
COPY requirements.txt requirements.txt
3839
COPY setup.py setup.py
3940

40-
# Perform build and cleanup artifacts
41+
# Perform build and cleanup artifacts and caches
4142
RUN \
4243
apk add --no-cache \
4344
git \
@@ -48,8 +49,8 @@ RUN \
4849
&& \
4950
if [ "${WITH_PLUGINS}" = "true" ]; then \
5051
pip install --no-cache-dir \
51-
'mkdocs-minify-plugin>=0.3' \
52-
'mkdocs-redirects>=1.0'; \
52+
"mkdocs-minify-plugin>=0.3" \
53+
"mkdocs-redirects>=1.0"; \
5354
fi \
5455
&& apk del .build gcc musl-dev \
5556
&& \
@@ -59,7 +60,12 @@ RUN \
5960
${PACKAGES}/material \
6061
${PACKAGES}/mkdocs/themes/$theme; \
6162
done \
62-
&& rm -rf /tmp/*
63+
&& rm -rf /tmp/* /root/.cache \
64+
&& \
65+
find ${PACKAGES} \
66+
-type f \
67+
-path "*/__pycache__/*" \
68+
-exec rm -f {} \;
6369

6470
# Set working directory
6571
WORKDIR /docs

0 commit comments

Comments
 (0)