summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorngosang <ngosang@hotmail.es>2022-10-26 21:00:19 +0200
committerngosang <ngosang@hotmail.es>2022-11-29 22:32:28 +0100
commit9417c284d3baf0f10534b9e3cc0a0c3ffe9c8544 (patch)
tree2b989d93ce44386b84a6cf1008d72221b7e49395 /Dockerfile
parent768659f2bdd1fbd376d809c2a727a4ea0768b973 (diff)
Reduce Docker image size
* Remove compiled sources. Most of them are never used. Those in use are compiled in the first run really fast. * Copy only source code and Docker entypoint * Image size reduced by 41 MB (195 MB -> 154 MB uncompressed)
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile14
1 files changed, 7 insertions, 7 deletions
diff --git a/Dockerfile b/Dockerfile
index 64aa8bce..71e27f0f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -45,21 +45,21 @@ RUN apk upgrade --no-cache \
uwsgi \
uwsgi-python3 \
brotli \
- && pip3 install --upgrade pip wheel setuptools \
&& pip3 install --no-cache -r requirements.txt \
&& apk del build-dependencies \
- && rm -rf /root/.cache
+ && rm -rf /root/.cache \
+ && find /usr/lib/python*/ -name '*.pyc' -delete
-COPY --chown=searxng:searxng . .
+COPY --chown=searxng:searxng dockerfiles ./dockerfiles
+COPY --chown=searxng:searxng searx ./searx
ARG TIMESTAMP_SETTINGS=0
ARG TIMESTAMP_UWSGI=0
ARG VERSION_GITCOMMIT=unknown
-RUN su searxng -c "/usr/bin/python3 -m compileall -q searx"; \
- touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \
- touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
- find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
+RUN touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml \
+ && touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini \
+ && find /usr/local/searxng/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
-o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
-type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+