Change Dockerfile to LinuxServer.io base
Improve Docker image by using lsiobase/python as base and adding PUID/PGID user mapping instead running as root, also reduce image size from ~900MB to 500MB
This commit is contained in:
parent
1798b6094d
commit
ba2da9dcf9
64
Dockerfile
64
Dockerfile
|
@ -1,13 +1,61 @@
|
|||
FROM python:3.8
|
||||
FROM lsiobase/python:3.11
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
ARG WHOOGLESEARCH_RELEASE
|
||||
ARG BUILD_DATE=unspecified
|
||||
ARG VCS_REF=unspecified
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
# set python to use utf-8 rather than ascii.
|
||||
ENV PYTHONIOENCODING="UTF-8"
|
||||
|
||||
COPY . .
|
||||
RUN chmod +x ./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.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}"
|
||||
|
||||
RUN \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --upgrade \
|
||||
cmake \
|
||||
g++ \
|
||||
gcc \
|
||||
git \
|
||||
make \
|
||||
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 && \
|
||||
echo "**** install app ****" && \
|
||||
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='[""]'); \
|
||||
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 && \
|
||||
echo "**** install pip packages ****" && \
|
||||
pip3 install --no-cache-dir -r \
|
||||
/tmp/whooglesearch/requirements.txt && \
|
||||
cp -r /tmp/whooglesearch/app / && \
|
||||
echo "**** Cleanup ****" && \
|
||||
rm -Rf /tmp/*
|
||||
|
||||
# add local files
|
||||
COPY root/ /
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# ports and volumes
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["./whoogle-search"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user