-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2ff9ca2
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# compiled output | ||
/tmp | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.history/* | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM python:3.10-slim | ||
|
||
LABEL author='eskwisit' | ||
LABEL description='Slim Docker container featuring embedded Nut server from blawar/nut latest release that works for most.' | ||
LABEL repo='eskwisit/nut-server' | ||
LABEL email='[email protected]' | ||
|
||
# Prepare Nut install | ||
RUN apt-get update && apt-get -y install \ | ||
gcc \ | ||
cron \ | ||
wget \ | ||
unzip \ | ||
libssl-dev \ | ||
libcurl4-openssl-dev \ | ||
zlib1g-dev \ | ||
libjpeg-dev | ||
|
||
# Fetch Nut codebase | ||
RUN wget https://github.com/blawar/nut/archive/refs/tags/v3.3.zip | ||
RUN unzip v3.3.zip -d /root | ||
RUN mv /root/nut-3.3 /root/nut | ||
|
||
# Tune config | ||
RUN mv /root/nut/conf/nut.default.conf /root/nut/conf/nut.conf | ||
RUN sed -i '/scan/c "scan": ["\/titles"]' /root/nut/conf/nut.conf | ||
|
||
# Remove GUI packages | ||
RUN sed -i '/pyqt5/d' /root/nut/requirements.txt | ||
RUN sed -i '/qt-range-slider/d' /root/nut/requirements.txt | ||
|
||
# Add missing requirements | ||
RUN echo markupsafe==2.0.1 >>/root/nut/requirements.txt | ||
|
||
# Install project dependencies | ||
RUN pip3 install -U pip | ||
RUN pip3 install -r /root/nut/requirements.txt | ||
|
||
COPY /entrypoint.sh / | ||
|
||
RUN chmod +x /entrypoint.sh | ||
|
||
VOLUME [ "/titles" ] | ||
|
||
EXPOSE 9000 | ||
|
||
# clean up | ||
RUN rm v3.3.zip | ||
RUN apt-get autoremove | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Nut-server | ||
|
||
Slim Docker image featuring embedded Nut server from [blawar/nut](https://github.com/blawar/nut) latest release that works for most. | ||
|
||
## Features | ||
|
||
- Thin Docker image. | ||
- Very low memory usage. | ||
- Designed to work on amd64 arch (Linux, Unix). | ||
- Cron task to poll new titles. | ||
- Zero config bundle. | ||
- Seamless integration for [Tinfoil](https://tinfoil.io/). | ||
|
||
## Usage | ||
|
||
```bash | ||
# Pull image from Docker hub | ||
docker pull eskwisit/nut-server | ||
|
||
# Run image | ||
docker run -d --name=nut-server -v /path/to/titles:/titles:rw eskwisit/nut-server | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
CRON_CMD='wget --spider --user guest --password guest' | ||
HOSTED_API=http://127.0.0.1:9000/api | ||
CRON_FOLDER=/etc/cron.d | ||
|
||
echo 'Registering cron task' | ||
|
||
rm -f $CRON_FOLDER/polling-titles && touch $CRON_FOLDER/polling-titles | ||
|
||
echo "0 1 * * * $CRON_CMD $HOSTED_API/scan" >>$CRON_FOLDER/polling-titles | ||
|
||
chmod 0644 $CRON_FOLDER/polling-titles | ||
|
||
crontab $CRON_FOLDER/polling-titles | ||
|
||
service cron start | ||
|
||
echo 'Starting nut server on port 9000' | ||
|
||
python3 /root/nut/nut.py --server |