Skip to content

Commit

Permalink
Allow to run through docker
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrs committed May 8, 2023
1 parent a9b6f4a commit 5cfccda
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Dockerfile
docker-compose.yaml

titledb/
titles/

keys.txt
prod.keys
gdrive.token
token.pickle
credentials.json
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.9

RUN apt-get update && apt-get install -y libusb-1.0-0-dev python3-pyqt5 libssl-dev libcurl4-openssl-dev

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

ARG USER=nut
ARG GROUP=nut
RUN addgroup --gid 1000 $USER && \
adduser --uid 1000 --ingroup $GROUP --home /home/$USER --shell /bin/sh --disabled-password --gecos "" $USER && \
curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.5.1/fixuid-0.5.1-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \
chown root:root /usr/local/bin/fixuid && \
chmod 4755 /usr/local/bin/fixuid && \
mkdir -p /etc/fixuid && \
printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml

USER $USER:$GROUP

ENTRYPOINT ["fixuid"]

CMD ["python", "/app/nut_gui.py"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/u
* Run `python nut.py` for CLI. Run `python3 nut_gui.py` to launch the application (this will *only* work if PyQT from Homebrew was succesfully installed via directions above)
</details>

### Docker

```console
$ docker build --tag nut https://github.com/blawar/nut.git
$ docker run --rm -it --network=host --env=DISPLAY --volume=/tmp/.X11-unix:/tmp/.X11-unix --volume="$PWD:$PWD" --workdir="$PWD" --user=$(id -u):$(id -g) nut
```

------

## License
Expand Down

0 comments on commit 5cfccda

Please sign in to comment.