-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
12 changed files
with
759 additions
and
427 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
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
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,38 @@ | ||
FROM debian:sid-slim | ||
|
||
ENV LC_ALL=C.UTF-8 \ | ||
LANG=C.UTF-8 \ | ||
LANGUAGE=en_US:en | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
RUN set -x && \ | ||
KEPT_PACKAGES=() && \ | ||
# Packages kept in the image | ||
KEPT_PACKAGES+=(bash) && \ | ||
KEPT_PACKAGES+=(ca-certificates) && \ | ||
KEPT_PACKAGES+=(locales) && \ | ||
KEPT_PACKAGES+=(locales-all) && \ | ||
KEPT_PACKAGES+=(python3) && \ | ||
KEPT_PACKAGES+=(python-is-python3) && \ | ||
KEPT_PACKAGES+=(python3-pip) && \ | ||
KEPT_PACKAGES+=(python3-pyxattr) && \ | ||
KEPT_PACKAGES+=(adduser) && \ | ||
# Install packages | ||
apt-get update -y && \ | ||
apt-get install -y --no-install-recommends \ | ||
${KEPT_PACKAGES[@]} \ | ||
&& \ | ||
# Create /config directory | ||
mkdir -p /config && \ | ||
# Clean-up | ||
apt-get autoremove -y && \ | ||
apt-get clean -y && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* | ||
RUN rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED && \ | ||
pip3 install --no-cache tvnamer | ||
|
||
# # Copy init script, set workdir, set configdir & entrypoint | ||
COPY init /init | ||
WORKDIR /workdir | ||
ENTRYPOINT ["/init"] |
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,37 @@ | ||
#!/bin/bash | ||
|
||
# Create dockeruser homedir | ||
mkdir -p /home/dockeruser | ||
|
||
# Set UID/PID of user that youtube-dl will be run as | ||
TVNAMERPGID=${PGID:-1000} | ||
TVNAMERPUID=${PUID:-1000} | ||
|
||
# Check to see if group/user already exist, if so, delete | ||
EXISTINGGROUPNAME=$(getent group "$TVNAMERPGID" | cut -d ':' -f 1) | ||
EXISTINGUSERNAME=$(getent passwd "$TVNAMERPUID" | cut -d ':' -f 1) | ||
if [[ -n "$EXISTINGGROUPNAME" ]]; then | ||
groupdel -f "$EXISTINGGROUPNAME" | ||
fi | ||
if [[ -n "$EXISTINGUSERNAME" ]]; then | ||
userdel -f "$EXISTINGUSERNAME" | ||
fi | ||
|
||
# Create user/group | ||
addgroup --quiet --gid "$TVNAMERPGID" dockeruser | ||
chown -R "$TVNAMERPUID":"$TVNAMERPGID" /home/dockeruser | ||
adduser --quiet --system --disabled-password --uid "$TVNAMERPUID" --gid "$TVNAMERPGID" --home /home/dockeruser dockeruser | ||
HOME=/home/dockeruser | ||
export HOME | ||
|
||
# Set UMASK if required | ||
if [[ -n "$UMASK" ]]; then | ||
umask "$UMASK" | ||
fi | ||
|
||
# Run tvnamer with remainder of command line arguments | ||
if [ -f /config/tvnamerconfig.json ]; then | ||
setpriv --reuid dockeruser --regid dockeruser --keep-groups tvnamer -c /config/tvnamerconfig.json "$@" | ||
else | ||
setpriv --reuid dockeruser --regid dockeruser --keep-groups tvnamer "$@" | ||
fi |
Oops, something went wrong.