mirror of
https://github.com/benbusby/whoogle-search
synced 2024-10-30 09:20:50 +00:00
Remove bash dependency
Depending on bash wasn't strictly necessary, as the two minimal scripts in the repo were both nearly POSIX anyways. Aside from simplifying the repo's dependencies a little bit, this also helps reduce the overall Docker image size as an added bonus.
This commit is contained in:
parent
2e3c647591
commit
9cbd7bd9d3
15
Dockerfile
15
Dockerfile
@ -14,9 +14,11 @@ RUN pip install --prefix /install --no-warn-script-location --no-cache-dir -r re
|
|||||||
|
|
||||||
FROM python:3.8-alpine
|
FROM python:3.8-alpine
|
||||||
|
|
||||||
RUN apk add --update --no-cache tor curl bash openrc
|
RUN apk add --update --no-cache tor curl openrc
|
||||||
# libcurl4-openssl-dev
|
# libcurl4-openssl-dev
|
||||||
|
|
||||||
|
RUN apk -U upgrade
|
||||||
|
|
||||||
ARG DOCKER_USER=whoogle
|
ARG DOCKER_USER=whoogle
|
||||||
ARG DOCKER_USERID=927
|
ARG DOCKER_USERID=927
|
||||||
ARG config_dir=/config
|
ARG config_dir=/config
|
||||||
@ -69,19 +71,20 @@ COPY app/ app/
|
|||||||
COPY run .
|
COPY run .
|
||||||
#COPY whoogle.env .
|
#COPY whoogle.env .
|
||||||
|
|
||||||
# Allow writing symlinks to build dir
|
|
||||||
RUN chown 102:102 app/static/build
|
|
||||||
|
|
||||||
# Create user/group to run as
|
# Create user/group to run as
|
||||||
RUN adduser -D -g $DOCKER_USERID -u $DOCKER_USERID $DOCKER_USER
|
RUN adduser -D -g $DOCKER_USERID -u $DOCKER_USERID $DOCKER_USER
|
||||||
|
|
||||||
# Fix ownership / permissions
|
# Fix ownership / permissions
|
||||||
RUN chown -R ${DOCKER_USER}:${DOCKER_USER} /whoogle /var/lib/tor
|
RUN chown -R ${DOCKER_USER}:${DOCKER_USER} /whoogle /var/lib/tor
|
||||||
|
|
||||||
|
# Allow writing symlinks to build dir
|
||||||
|
RUN chown $DOCKER_USERID:$DOCKER_USERID app/static/build
|
||||||
|
|
||||||
USER $DOCKER_USER:$DOCKER_USER
|
USER $DOCKER_USER:$DOCKER_USER
|
||||||
|
|
||||||
EXPOSE $EXPOSE_PORT
|
EXPOSE $EXPOSE_PORT
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=5s \
|
HEALTHCHECK --interval=30s --timeout=5s \
|
||||||
CMD curl -f http://localhost:${EXPOSE_PORT}/healthz || exit 1
|
CMD curl -f http://localhost:${EXPOSE_PORT}/healthz || exit 1
|
||||||
|
|
||||||
CMD misc/tor/start-tor.sh & ./run
|
CMD misc/tor/start-tor.sh & ./run
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if [ "$(whoami)" != "root" ]; then
|
||||||
tor -f /etc/tor/torrc
|
tor -f /etc/tor/torrc
|
||||||
|
8
run
8
run
@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./run # Runs the full web app
|
# ./run # Runs the full web app
|
||||||
# ./run test # Runs the testing suite
|
# ./run test # Runs the testing suite
|
||||||
|
|
||||||
set -euo pipefail
|
set -eu
|
||||||
|
|
||||||
SCRIPT_DIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
SCRIPT_DIR="$(CDPATH= command cd -- "$(dirname -- "$0")" && pwd -P)"
|
||||||
|
|
||||||
# Set directory to serve static content from
|
# Set directory to serve static content from
|
||||||
SUBDIR="${1:-app}"
|
SUBDIR="${1:-app}"
|
||||||
@ -17,7 +17,7 @@ rm -f "$SCRIPT_DIR"/app/static/build/*.js
|
|||||||
rm -f "$SCRIPT_DIR"/app/static/build/*.css
|
rm -f "$SCRIPT_DIR"/app/static/build/*.css
|
||||||
|
|
||||||
# Check for regular vs test run
|
# Check for regular vs test run
|
||||||
if [[ "$SUBDIR" == "test" ]]; then
|
if [ "$SUBDIR" = "test" ]; then
|
||||||
# Set up static files for testing
|
# Set up static files for testing
|
||||||
rm -rf "$STATIC_FOLDER"
|
rm -rf "$STATIC_FOLDER"
|
||||||
ln -s "$SCRIPT_DIR/app/static" "$STATIC_FOLDER"
|
ln -s "$SCRIPT_DIR/app/static" "$STATIC_FOLDER"
|
||||||
|
Loading…
Reference in New Issue
Block a user