Skip to content

Commit 5db32d9

Browse files
Added PUID and PGID environmental variables
1 parent 0174a3c commit 5db32d9

File tree

3 files changed

+60
-11
lines changed

3 files changed

+60
-11
lines changed

Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ FROM python:3.12-alpine
44
ARG RELEASE_VERSION
55
ENV RELEASE_VERSION=${RELEASE_VERSION}
66

7-
# Create User
8-
ARG UID=1000
9-
ARG GID=1000
10-
RUN addgroup -g $GID general_user && \
11-
adduser -D -u $UID -G general_user -s /bin/sh general_user
7+
# Install ffmpeg and su-exec
8+
RUN apk update && apk add --no-cache ffmpeg su-exec
129

1310
# Create directories and set permissions
1411
COPY . /bookbounty
1512
WORKDIR /bookbounty
16-
RUN mkdir -p /bookbounty/downloads
17-
RUN chown -R $UID:$GID /bookbounty
18-
RUN chmod -R 777 /bookbounty/downloads
1913

20-
# Install requirements and run code as general_user
14+
# Install requirements
2115
RUN pip install --no-cache-dir -r requirements.txt
16+
17+
# Make the script executable
18+
RUN chmod +x thewicklowwolf-init.sh
19+
20+
# Expose port
2221
EXPOSE 5000
23-
USER general_user
24-
CMD ["gunicorn","src.BookBounty:app", "-c", "gunicorn_config.py"]
22+
23+
# Start the app
24+
ENTRYPOINT ["./thewicklowwolf-init.sh"]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ services:
3131

3232
Certain values can be set via environment variables:
3333

34+
* __PUID__: The user ID to run the app with. Defaults to `1000`.
35+
* __PGID__: The group ID to run the app with. Defaults to `1000`.
3436
* __readarr_address__: The URL for Readarr. Defaults to `http://192.168.1.2:8787`.
3537
* __readarr_api_key__: The API key for Readarr. Defaults to ` `.
3638
* __libgen_address__: The URL for Library Genesis. The only supported URL at present is `http://libgen.is`.

thewicklowwolf-init.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
echo -e "\033[1;32mTheWicklowWolf\033[0m"
4+
echo -e "\033[1;34mBookBounty\033[0m"
5+
echo "Initializing app..."
6+
7+
cat << 'EOF'
8+
_____________________________________
9+
10+
.-'''''-.
11+
.' `.
12+
: :
13+
: :
14+
: _/| :
15+
: =/_/ :
16+
`._/ | .'
17+
( / ,|...-'
18+
\_/^\/||__
19+
_/~ `""~`"` \_
20+
__/ -'/ `-._ `\_\__
21+
/ /-'` `\ \ \-.\
22+
_____________________________________
23+
Brought to you by TheWicklowWolf
24+
_____________________________________
25+
26+
If you'd like to buy me a coffee:
27+
https://buymeacoffee.com/thewicklow
28+
29+
EOF
30+
31+
PUID=${PUID:-1000}
32+
PGID=${PGID:-1000}
33+
34+
echo "-----------------"
35+
echo -e "\033[1mRunning with:\033[0m"
36+
echo "PUID=${PUID}"
37+
echo "PGID=${PGID}"
38+
echo "-----------------"
39+
40+
# Create the required directories with the correct permissions
41+
echo "Setting up directories.."
42+
mkdir -p /bookbounty/downloads /bookbounty/config
43+
chown -R ${PUID}:${PGID} /bookbounty
44+
45+
# Start the application with the specified user permissions
46+
echo "Running BookBounty..."
47+
exec su-exec ${PUID}:${PGID} gunicorn src.BookBounty:app -c gunicorn_config.py

0 commit comments

Comments
 (0)