From cdba75258705a8d9edac229be5c8df4077474aa0 Mon Sep 17 00:00:00 2001 From: "Mohammed A.Q" <65144622+mohammedalqadi@users.noreply.github.com> Date: Tue, 19 May 2020 03:32:37 +0000 Subject: [PATCH] Update Docker file fo the latest Changes - Remove unnecessary packages and reduce image size. - Add Enforce HTTPS option - Added Config Volume --- Dockerfile | 72 +++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1165816..45b5478 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM lsiobase/python:3.11 +# set version release ARG WHOOGLESEARCH_RELEASE ARG BUILD_DATE=unspecified ARG VCS_REF=unspecified @@ -7,55 +8,60 @@ ARG VCS_REF=unspecified # set python to use utf-8 rather than ascii. ENV PYTHONIOENCODING="UTF-8" +# enforced https, default false +ARG use_https='' +ENV HTTPS_ONLY="$use_https" + LABEL org.label-schema.name="Whoogle Search" -LABEL org.label-schema.description="Self-hosted, ad-free, privacy-respecting alternative to Google search" +LABEL org.label-schema.description="Self-hosted, ad-free, privacy-respecting Google metasearch engine" LABEL org.label-schema.vcs-url="https://github.com/benbusby/whoogle-search" -LABEL org.label-schema.build-date="${BUILD_DATE:-unspecified}" -LABEL org.label-schema.vcs-ref="${VCS_REF:-unspecified}" +LABEL org.label-schema.build-date="${BUILD_DATE}" +LABEL org.label-schema.vcs-ref="${VCS_REF}" RUN \ echo "**** install build packages ****" && \ - apk add --no-cache --upgrade \ - cmake \ - g++ \ - gcc \ - git \ - make \ - curl-dev \ - libressl-dev \ - libffi-dev \ - python3-dev && \ + apk add --no-cache --upgrade --virtual .build-dependencies \ + g++ \ + git \ + curl-dev \ + libressl-dev \ + libffi-dev \ + python3-dev && \ echo "**** install runtime packages ****" && \ apk add --no-cache --upgrade \ - curl \ - nano \ - py3-pip \ - py3-pylast \ - python3 \ - tar \ - wget && \ + curl \ + py3-pip \ + python3 \ + tar && \ echo "**** install app ****" && \ - mkdir -p /tmp/whooglesearch && \ + mkdir -p \ + /tmp/whooglesearch && \ if [ -z ${WHOOGLESEARCH_RELEASE+x} ]; then \ - WHOOGLESEARCH_RELEASE=$(curl -sX GET "https://api.github.com/repos/benbusby/whoogle-search/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ + WHOOGLESEARCH_RELEASE=$(curl -sX GET "https://api.github.com/repos/benbusby/whoogle-search/commits/master" \ + | awk '/sha/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ - /tmp/whooglesearch.tar.gz -L \ - "https://github.com/benbusby/whoogle-search/archive/${WHOOGLESEARCH_RELEASE}.tar.gz" && \ - tar xf /tmp/whooglesearch.tar.gz -C \ - /tmp/whooglesearch --strip-components=1 && \ + /tmp/whooglesearch.tar.gz -L \ + "https://github.com/benbusby/whoogle-search/archive/${WHOOGLESEARCH_RELEASE}.tar.gz" && \ + tar xf \ + /tmp/whooglesearch.tar.gz -C \ + /tmp/whooglesearch --strip-components=1 && \ echo "**** install pip packages ****" && \ pip3 install --no-cache-dir -r \ - /tmp/whooglesearch/requirements.txt && \ - cp -r /tmp/whooglesearch/app / && \ - echo "**** Cleanup ****" && \ - rm -Rf /tmp/* + /tmp/whooglesearch/requirements.txt && \ + cp -r /tmp/whooglesearch/app / && \ + echo "**** clean up ****" && \ + apk del --purge \ + .build-dependencies && \ + rm -rf \ + /tmp/* + +# set config location +ENV CONFIG_VOLUME="/config" # add local files COPY root/ / -WORKDIR /app - # ports and volumes EXPOSE 5000 +VOLUME /config