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.
main
Ben Busby 2022-01-25 13:07:21 -07:00
parent 2e3c647591
commit 9cbd7bd9d3
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1
3 changed files with 14 additions and 11 deletions

View File

@ -14,9 +14,11 @@ RUN pip install --prefix /install --no-warn-script-location --no-cache-dir -r re
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
RUN apk -U upgrade
ARG DOCKER_USER=whoogle
ARG DOCKER_USERID=927
ARG config_dir=/config
@ -69,19 +71,20 @@ COPY app/ app/
COPY run .
#COPY whoogle.env .
# Allow writing symlinks to build dir
RUN chown 102:102 app/static/build
# 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
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
EXPOSE $EXPOSE_PORT
HEALTHCHECK --interval=30s --timeout=5s \
HEALTHCHECK --interval=30s --timeout=5s \
CMD curl -f http://localhost:${EXPOSE_PORT}/healthz || exit 1
CMD misc/tor/start-tor.sh & ./run

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
if [ "$(whoami)" != "root" ]; then
tor -f /etc/tor/torrc

8
run
View File

@ -1,11 +1,11 @@
#!/bin/bash
#!/bin/sh
# Usage:
# ./run # Runs the full web app
# ./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
SUBDIR="${1:-app}"
@ -17,7 +17,7 @@ rm -f "$SCRIPT_DIR"/app/static/build/*.js
rm -f "$SCRIPT_DIR"/app/static/build/*.css
# Check for regular vs test run
if [[ "$SUBDIR" == "test" ]]; then
if [ "$SUBDIR" = "test" ]; then
# Set up static files for testing
rm -rf "$STATIC_FOLDER"
ln -s "$SCRIPT_DIR/app/static" "$STATIC_FOLDER"