From 9cb73c073f9ee9ec2a8b9bcda94e1a2d398be4b5 Mon Sep 17 00:00:00 2001 From: Logan Williams Date: Wed, 10 May 2023 11:08:49 +0200 Subject: [PATCH 1/2] Simplify entrypoint --- Dockerfile | 5 +---- docker-entrypoint.sh | 27 --------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 000801d..2eef717 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,10 +26,7 @@ COPY ./src/ . # RUN useradd --system --groups sudo --shell /bin/bash archiver && chown -R archiver:sudo . # USER archiver -ADD docker-entrypoint.sh /docker-entrypoint.sh -ENTRYPOINT ["/docker-entrypoint.sh"] - -CMD ["python3"] +ENTRYPOINT ["pipenv", "run", "python3", "-m", "auto_archiver"] # should be executed with 2 volumes (3 if local_storage) # docker run -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive aa --help \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh deleted file mode 100755 index d8224bc..0000000 --- a/docker-entrypoint.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# Get UID/GID from volume dir - -VOLUME_UID=$(stat -c '%u' /crawls) -VOLUME_GID=$(stat -c '%g' /crawls) - -# Get the UID/GID we are running as - -MY_UID=$(id -u) -MY_GID=$(id -g) - -# If we aren't running as the owner of the /crawls/ dir then add a new user -# btrix with the same UID/GID of the /crawls dir and run as that user instead. - -if [ "$MY_GID" != "$VOLUME_GID" ] || [ "$MY_UID" != "$VOLUME_UID" ]; then - groupadd btrix - groupmod -o --gid $VOLUME_GID btrix - - useradd -ms /bin/bash -g $VOLUME_GID btrix - usermod -o -u $VOLUME_UID btrix > /dev/null - - su btrix -c '"$@"' -- argv0-ignore "$@" -else - exec "$@" -fi - From 2e63cb84114c244657f3fbea1bad087d6ec08b0b Mon Sep 17 00:00:00 2001 From: Logan Williams Date: Wed, 10 May 2023 11:13:47 +0200 Subject: [PATCH 2/2] Update README with new entrypoint --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03d513c..2ff573a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Docker works like a virtual machine running inside your computer, it isolates ev 1. install [docker](https://docs.docker.com/get-docker/) 2. pull the auto-archiver docker [image](https://hub.docker.com/r/bellingcat/auto-archiver) with `docker pull bellingcat/auto-archiver` -3. run the docker image locally in a container: `docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver -m auto_archiver --config secrets/orchestration.yaml` breaking this command down: +3. run the docker image locally in a container: `docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver --config secrets/orchestration.yaml` breaking this command down: 1. `docker run` tells docker to start a new container (an instance of the image) 2. `--rm` makes sure this container is removed after execution (less garbage locally) 3. `-v $PWD/secrets:/app/secrets` - your secrets folder