Skip to content

Commit

Permalink
Merge pull request #4 from dandroid126/dandroid/containerization
Browse files Browse the repository at this point in the history
Changed Dockerfile to copy all python scripts in the root directory, updated documentation
  • Loading branch information
db0 authored Sep 2, 2023
2 parents bcd71ae + 3c7146c commit bdb7bb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions CONTAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Edit the env_example file that was downloaded and enter the details for your set
## Run the container
Specify which script you want to run and all of the arguments you want to pass it at the end of the line

### All mode, local storage example
Local storage mode requires you to enter the passphrase of your ssh key, which means you must pass the `-it` options and must not pass the `-d` option. After entering your passphrase, you can detach your shell from the container with `Ctrl-P, Ctrl-Q`
### All mode, remote storage example
Remote storage mode requires you to enter the passphrase of your ssh key, which means you must pass the `-it` options and must not pass the `-d` option. After entering your passphrase, you can detach your shell from the container with `Ctrl-P, Ctrl-Q`
```
docker run -it --rm --device nvidia.com/gpu=all --name lemmy-safety -v ./env_example:/app/.env -v ./lemmy_safety.db:/app/lemmy_safety.db -v /path/to/ssh/key/on/host.key:/app/private_key lemmy-safety:latest lemmy_safety_local_storage.py --all
docker run -it --rm --device nvidia.com/gpu=all --name lemmy-safety -v ./env_example:/app/.env -v ./lemmy_safety.db:/app/lemmy_safety.db -v /path/to/ssh/key/on/host.key:/app/private_key ghcr.io/db0/lemmy-safety:main lemmy_safety_remote_storage.py --all
```

### Daemon mode, object storage example:
Object storage mode does not require you to interact with the container, so you can pass the `-d` option.
```
docker run -d --rm --device nvidia.com/gpu=all --name lemmy-safety -v ./env_example:/app/.env -v ./lemmy_safety.db:/app/lemmy_safety.db lemmy-safety:latest lemmy_safety_object_storage.py
docker run -d --rm --device nvidia.com/gpu=all --name lemmy-safety -v ./env_example:/app/.env -v ./lemmy_safety.db:/app/lemmy_safety.db ghcr.io/db0/lemmy-safety:main lemmy_safety_object_storage.py
```
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ FROM docker.io/python:3.10-slim-bookworm

WORKDIR /app
COPY lemmy_safety lemmy_safety
COPY lemmy_safety_local_storage.py lemmy_safety_local_storage.py
COPY lemmy_safety_object_storage.py lemmy_safety_object_storage.py
COPY *.py .
COPY requirements.txt requirements.txt

ENV PYTHONPATH='/app'
Expand Down

0 comments on commit bdb7bb3

Please sign in to comment.