Update Docker file fo the latest Changes
- Remove unnecessary packages and reduce image size. - Add Enforce HTTPS option - Added Config Volume
This commit is contained in:
parent
bde7003584
commit
cdba752587
72
Dockerfile
72
Dockerfile
|
@ -1,5 +1,6 @@
|
||||||
FROM lsiobase/python:3.11
|
FROM lsiobase/python:3.11
|
||||||
|
|
||||||
|
# set version release
|
||||||
ARG WHOOGLESEARCH_RELEASE
|
ARG WHOOGLESEARCH_RELEASE
|
||||||
ARG BUILD_DATE=unspecified
|
ARG BUILD_DATE=unspecified
|
||||||
ARG VCS_REF=unspecified
|
ARG VCS_REF=unspecified
|
||||||
|
@ -7,55 +8,60 @@ ARG VCS_REF=unspecified
|
||||||
# set python to use utf-8 rather than ascii.
|
# set python to use utf-8 rather than ascii.
|
||||||
ENV PYTHONIOENCODING="UTF-8"
|
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.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.vcs-url="https://github.com/benbusby/whoogle-search"
|
||||||
LABEL org.label-schema.build-date="${BUILD_DATE:-unspecified}"
|
LABEL org.label-schema.build-date="${BUILD_DATE}"
|
||||||
LABEL org.label-schema.vcs-ref="${VCS_REF:-unspecified}"
|
LABEL org.label-schema.vcs-ref="${VCS_REF}"
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
echo "**** install build packages ****" && \
|
echo "**** install build packages ****" && \
|
||||||
apk add --no-cache --upgrade \
|
apk add --no-cache --upgrade --virtual .build-dependencies \
|
||||||
cmake \
|
g++ \
|
||||||
g++ \
|
git \
|
||||||
gcc \
|
curl-dev \
|
||||||
git \
|
libressl-dev \
|
||||||
make \
|
libffi-dev \
|
||||||
curl-dev \
|
python3-dev && \
|
||||||
libressl-dev \
|
|
||||||
libffi-dev \
|
|
||||||
python3-dev && \
|
|
||||||
echo "**** install runtime packages ****" && \
|
echo "**** install runtime packages ****" && \
|
||||||
apk add --no-cache --upgrade \
|
apk add --no-cache --upgrade \
|
||||||
curl \
|
curl \
|
||||||
nano \
|
py3-pip \
|
||||||
py3-pip \
|
python3 \
|
||||||
py3-pylast \
|
tar && \
|
||||||
python3 \
|
|
||||||
tar \
|
|
||||||
wget && \
|
|
||||||
echo "**** install app ****" && \
|
echo "**** install app ****" && \
|
||||||
mkdir -p /tmp/whooglesearch && \
|
mkdir -p \
|
||||||
|
/tmp/whooglesearch && \
|
||||||
if [ -z ${WHOOGLESEARCH_RELEASE+x} ]; then \
|
if [ -z ${WHOOGLESEARCH_RELEASE+x} ]; then \
|
||||||
WHOOGLESEARCH_RELEASE=$(curl -sX GET "https://api.github.com/repos/benbusby/whoogle-search/commits/master" \
|
WHOOGLESEARCH_RELEASE=$(curl -sX GET "https://api.github.com/repos/benbusby/whoogle-search/commits/master" \
|
||||||
| awk '/sha/{print $4;exit}' FS='[""]'); \
|
| awk '/sha/{print $4;exit}' FS='[""]'); \
|
||||||
fi && \
|
fi && \
|
||||||
curl -o \
|
curl -o \
|
||||||
/tmp/whooglesearch.tar.gz -L \
|
/tmp/whooglesearch.tar.gz -L \
|
||||||
"https://github.com/benbusby/whoogle-search/archive/${WHOOGLESEARCH_RELEASE}.tar.gz" && \
|
"https://github.com/benbusby/whoogle-search/archive/${WHOOGLESEARCH_RELEASE}.tar.gz" && \
|
||||||
tar xf /tmp/whooglesearch.tar.gz -C \
|
tar xf \
|
||||||
/tmp/whooglesearch --strip-components=1 && \
|
/tmp/whooglesearch.tar.gz -C \
|
||||||
|
/tmp/whooglesearch --strip-components=1 && \
|
||||||
echo "**** install pip packages ****" && \
|
echo "**** install pip packages ****" && \
|
||||||
pip3 install --no-cache-dir -r \
|
pip3 install --no-cache-dir -r \
|
||||||
/tmp/whooglesearch/requirements.txt && \
|
/tmp/whooglesearch/requirements.txt && \
|
||||||
cp -r /tmp/whooglesearch/app / && \
|
cp -r /tmp/whooglesearch/app / && \
|
||||||
echo "**** Cleanup ****" && \
|
echo "**** clean up ****" && \
|
||||||
rm -Rf /tmp/*
|
apk del --purge \
|
||||||
|
.build-dependencies && \
|
||||||
|
rm -rf \
|
||||||
|
/tmp/*
|
||||||
|
|
||||||
|
# set config location
|
||||||
|
ENV CONFIG_VOLUME="/config"
|
||||||
|
|
||||||
# add local files
|
# add local files
|
||||||
COPY root/ /
|
COPY root/ /
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# ports and volumes
|
# ports and volumes
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
VOLUME /config
|
||||||
|
|
Loading…
Reference in New Issue
Block a user