From 6be53f69bac9c5eecea4401f7a6d51027b88579f Mon Sep 17 00:00:00 2001 From: Ben Busby <33362396+benbusby@users.noreply.github.com> Date: Fri, 15 May 2020 14:53:39 -0600 Subject: [PATCH] Dockerfile: removed HTTPS enforcement, updated PORT setting Dockerfile no longer enforces an HTTPS connection, but still allows for setting via a build arg. The Flask server port is now configurable as a build arg as well, by setting a port number to "whoogle_port" --- Dockerfile | 7 +++++-- README.md | 4 ---- whoogle-search | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index a73073f..dda40c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,11 +10,14 @@ RUN mkdir $config_dir VOLUME $config_dir ENV CONFIG_VOLUME=$config_dir -ARG use_https=1 +ARG use_https='' ENV HTTPS_ONLY=$use_https +ARG whoogle_port=5000 +ENV EXPOSE_PORT=${EXPOSE_PORT:-$whoogle_port} + COPY . . -EXPOSE 5000 +EXPOSE $EXPOSE_PORT CMD ["./whoogle-search"] diff --git a/README.md b/README.md index a3a5c06..95de42c 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,6 @@ pip install -r requirements.txt ``` ### E) Manual (Docker) -___ -*Note: Docker containers run by default with https enforcement. If your instance will be run over http, you'll need to add `--build-arg use_https=0` to your run command.* -___ - 1. Ensure the Docker daemon is running, and is accessible by your user account - To add user permissions, you can execute `sudo usermod -aG docker yourusername` - Running `docker ps` should return something besides an error. If you encounter an error saying the daemon isn't running, try `sudo systemctl start docker` (Linux) or ensure the docker tool is running (Windows/macOS). diff --git a/whoogle-search b/whoogle-search index 298bf45..f87c61a 100755 --- a/whoogle-search +++ b/whoogle-search @@ -7,7 +7,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" # Set default port if unavailable if [[ -z "${PORT}" ]]; then - PORT=5000 + PORT="${EXPOSE_PORT:-5000}" fi # Set directory to serve static content from @@ -21,5 +21,5 @@ mkdir -p $STATIC_FOLDER if [[ $SUBDIR == "test" ]]; then pytest -sv else - python3 -um app --host 0.0.0.0 --port $PORT --debug + python3 -um app --host 0.0.0.0 --port $PORT fi