Resolving Dockerfile/docker-compose conflicts
This commit is contained in:
commit
2417fe72b4
85
Dockerfile
85
Dockerfile
|
@ -1,28 +1,81 @@
|
||||||
FROM python:3.8-slim
|
FROM lsiobase/python:3.11
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
# set version release
|
||||||
RUN apt-get update && apt-get install -y build-essential libcurl4-openssl-dev libssl-dev
|
ARG WHOOGLESEARCH_RELEASE
|
||||||
COPY requirements.txt .
|
ARG BUILD_DATE=unspecified
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
ARG VCS_REF=unspecified
|
||||||
|
|
||||||
ARG config_dir=/config
|
# set python to use utf-8 rather than ascii.
|
||||||
RUN mkdir -p $config_dir
|
ENV PYTHONIOENCODING="UTF-8"
|
||||||
VOLUME $config_dir
|
|
||||||
ENV CONFIG_VOLUME=$config_dir
|
# enforced https, default false
|
||||||
|
ARG use_https=''
|
||||||
|
ENV HTTPS_ONLY="$use_https"
|
||||||
|
|
||||||
ARG username=''
|
ARG username=''
|
||||||
ENV WHOOGLE_USER=$username
|
ENV WHOOGLE_USER=$username
|
||||||
ARG password=''
|
ARG password=''
|
||||||
ENV WHOOGLE_PASS=$password
|
ENV WHOOGLE_PASS=$password
|
||||||
|
|
||||||
ARG use_https=''
|
# set config volume
|
||||||
ENV HTTPS_ONLY=$use_https
|
ARG config_dir=/config
|
||||||
|
RUN mkdir -p $config_dir
|
||||||
|
VOLUME $config_dir
|
||||||
|
ENV CONFIG_VOLUME=$config_dir
|
||||||
|
|
||||||
|
LABEL org.label-schema.name="Whoogle 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}"
|
||||||
|
LABEL org.label-schema.vcs-ref="${VCS_REF}"
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
echo "**** install build packages ****" && \
|
||||||
|
apk add --no-cache --upgrade --virtual .build-dependencies \
|
||||||
|
g++ \
|
||||||
|
git \
|
||||||
|
curl-dev \
|
||||||
|
libressl-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libxslt-dev \
|
||||||
|
libffi-dev \
|
||||||
|
python3-dev && \
|
||||||
|
echo "**** install runtime packages ****" && \
|
||||||
|
apk add --no-cache --upgrade \
|
||||||
|
curl \
|
||||||
|
py3-pip \
|
||||||
|
python3 \
|
||||||
|
tar && \
|
||||||
|
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 "**** clean up ****" && \
|
||||||
|
apk del --purge \
|
||||||
|
.build-dependencies && \
|
||||||
|
rm -rf \
|
||||||
|
/tmp/*
|
||||||
|
|
||||||
|
# set config location
|
||||||
|
ENV CONFIG_VOLUME="/config"
|
||||||
|
|
||||||
|
# add local files
|
||||||
|
COPY root/ /
|
||||||
|
|
||||||
|
# search port
|
||||||
ARG whoogle_port=5000
|
ARG whoogle_port=5000
|
||||||
ENV EXPOSE_PORT=$whoogle_port
|
ENV EXPOSE_PORT=$whoogle_port
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
EXPOSE $EXPOSE_PORT
|
EXPOSE $EXPOSE_PORT
|
||||||
|
|
||||||
CMD ["./run"]
|
|
||||||
|
|
69
Dockerfile.aarch64
Normal file
69
Dockerfile.aarch64
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
FROM lsiobase/python:arm64v8-3.11
|
||||||
|
|
||||||
|
# set version release
|
||||||
|
ARG WHOOGLESEARCH_RELEASE
|
||||||
|
ARG BUILD_DATE=unspecified
|
||||||
|
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 Google metasearch engine"
|
||||||
|
LABEL org.label-schema.vcs-url="https://github.com/benbusby/whoogle-search"
|
||||||
|
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 --virtual .build-dependencies \
|
||||||
|
g++ \
|
||||||
|
git \
|
||||||
|
curl-dev \
|
||||||
|
libressl-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libxslt-dev \
|
||||||
|
libffi-dev \
|
||||||
|
python3-dev && \
|
||||||
|
echo "**** install runtime packages ****" && \
|
||||||
|
apk add --no-cache --upgrade \
|
||||||
|
curl \
|
||||||
|
py3-pip \
|
||||||
|
python3 \
|
||||||
|
tar && \
|
||||||
|
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 "**** clean up ****" && \
|
||||||
|
apk del --purge \
|
||||||
|
.build-dependencies && \
|
||||||
|
rm -rf \
|
||||||
|
/tmp/*
|
||||||
|
|
||||||
|
# set config location
|
||||||
|
ENV CONFIG_VOLUME="/config"
|
||||||
|
|
||||||
|
# add local files
|
||||||
|
COPY root/ /
|
||||||
|
|
||||||
|
# ports and volumes
|
||||||
|
EXPOSE 5000
|
||||||
|
VOLUME /config
|
69
Dockerfile.armhf
Normal file
69
Dockerfile.armhf
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
FROM lsiobase/python:arm32v7-3.11
|
||||||
|
|
||||||
|
# set version release
|
||||||
|
ARG WHOOGLESEARCH_RELEASE
|
||||||
|
ARG BUILD_DATE=unspecified
|
||||||
|
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 Google metasearch engine"
|
||||||
|
LABEL org.label-schema.vcs-url="https://github.com/benbusby/whoogle-search"
|
||||||
|
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 --virtual .build-dependencies \
|
||||||
|
g++ \
|
||||||
|
git \
|
||||||
|
curl-dev \
|
||||||
|
libressl-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libxslt-dev \
|
||||||
|
libffi-dev \
|
||||||
|
python3-dev && \
|
||||||
|
echo "**** install runtime packages ****" && \
|
||||||
|
apk add --no-cache --upgrade \
|
||||||
|
curl \
|
||||||
|
py3-pip \
|
||||||
|
python3 \
|
||||||
|
tar && \
|
||||||
|
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 "**** clean up ****" && \
|
||||||
|
apk del --purge \
|
||||||
|
.build-dependencies && \
|
||||||
|
rm -rf \
|
||||||
|
/tmp/*
|
||||||
|
|
||||||
|
# set config location
|
||||||
|
ENV CONFIG_VOLUME="/config"
|
||||||
|
|
||||||
|
# add local files
|
||||||
|
COPY root/ /
|
||||||
|
|
||||||
|
# ports and volumes
|
||||||
|
EXPOSE 5000
|
||||||
|
VOLUME /config
|
30
README.md
30
README.md
|
@ -157,6 +157,36 @@ docker run --publish 5000:5000 --detach --name whoogle-search whoogle-search:1.0
|
||||||
|
|
||||||
And kill with: `docker rm --force whoogle-search`
|
And kill with: `docker rm --force whoogle-search`
|
||||||
|
|
||||||
|
#### Docker-Compose
|
||||||
|
|
||||||
|
```bash
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
whoogle-search:
|
||||||
|
container_name: whoogle-search
|
||||||
|
hostname: whoogle-search
|
||||||
|
image: "benbusby/whoogle-search"
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/London
|
||||||
|
- WEB_PORT=5000 #optional default 5000
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Docker Parameters
|
||||||
|
|
||||||
|
Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container.
|
||||||
|
|
||||||
|
| Parameter | Function |
|
||||||
|
| :----: | --- |
|
||||||
|
| `-e PUID=1000` | for UserID |
|
||||||
|
| `-e PGID=1000` | for GroupID |
|
||||||
|
| `-e TZ=Europe/London` | Specify a timezone to use |
|
||||||
|
| `-e WEB_PORT=5000` | set the server port to expose, default to 5000, **optional** |
|
||||||
|
|
||||||
#### Using [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
|
#### Using [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
|
||||||
```bash
|
```bash
|
||||||
heroku login
|
heroku login
|
||||||
|
|
|
@ -1,9 +1,25 @@
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
whoogle-search:
|
# ----------------------------------------
|
||||||
image: benbusby/whoogle-search
|
whoogle-search:
|
||||||
container_name: whoogle-search
|
container_name: whoogle-search
|
||||||
ports:
|
hostname: whoogle-search
|
||||||
- 5000:5000
|
# Uncomment to build from local
|
||||||
restart: unless-stopped
|
# build:
|
||||||
|
# dockerfile: Dockerfile
|
||||||
|
# context: .
|
||||||
|
# image: "whoogle-search"
|
||||||
|
image: "benbusby/whoogle-search"
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
volumes:
|
||||||
|
- path/to/config:/config
|
||||||
|
environment:
|
||||||
|
- PUID=${PUID} # User uid
|
||||||
|
- PGID=${PGID} # User gid
|
||||||
|
- TZ=${TZ} # TimeZone
|
||||||
|
- EXPOSE_PORT=5000 # Default port 5000
|
||||||
|
- USER= # Optional
|
||||||
|
- PASSWORD= # Optional
|
||||||
|
|
11
root/etc/cont-init.d/30-config
Normal file
11
root/etc/cont-init.d/30-config
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
|
# make needed folder
|
||||||
|
mkdir -p \
|
||||||
|
/config/
|
||||||
|
|
||||||
|
# permissions
|
||||||
|
chown -R abc:abc \
|
||||||
|
/app
|
||||||
|
chown -R abc:abc \
|
||||||
|
/config
|
19
root/etc/services.d/whooglesearch/run
Normal file
19
root/etc/services.d/whooglesearch/run
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
|
ADDRESS=${ADDRESS:-0.0.0.0}
|
||||||
|
EXPOSE_PORT=${EXPOSE_PORT:-5000}
|
||||||
|
USER=${USER}
|
||||||
|
PASSWORD=${PASSWORD}
|
||||||
|
|
||||||
|
cd /
|
||||||
|
|
||||||
|
# Create User Authentication if specified
|
||||||
|
if [ -z "${USER}" ] && [ -z "${PASSWORD}" ]; then
|
||||||
|
echo "No User and Password Will be set for Basic authentication"
|
||||||
|
exec \
|
||||||
|
s6-setuidgid abc python3 -um app --host "${ADDRESS}" --port "${EXPOSE_PORT}"
|
||||||
|
else
|
||||||
|
echo "Setting Up Basic Authentication with Username="$USER" Password="$PASSWORD""
|
||||||
|
exec \
|
||||||
|
s6-setuidgid abc python3 -um app --host "${ADDRESS}" --port "${EXPOSE_PORT}" --userpass "$USER":"$PASSWORD"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user