Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(entrypoint): add entrypoint script to ENTRYPOINT #1113

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/scripts/templates/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ Some applications do not support defining configuration via environment variable

1. First read the Kubernetes docs on [defining command and arguments for a Container](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/).
2. Look up the documentation for the application and find a argument you would like to set.
3. Set the argument in the `args` section, be sure to include `entrypoint.sh` as the first arg and any application specific arguments thereafter.
3. Set the extra arguments in the `args` section like below.

```yaml
args:
- /entrypoint.sh
- --port
- "8080"
```
Expand Down
15 changes: 6 additions & 9 deletions apps/bazarr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ ENV \
ENV UMASK="0002" \
TZ="Etc/UTC"

ENV BAZARR__PORT=6767

USER root
WORKDIR /app

Expand Down Expand Up @@ -56,22 +58,17 @@ RUN \
&& pip install --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20/ \
--requirement /app/bin/requirements.txt \
--requirement /app/bin/postgres-requirements.txt \
&& chown -R root:root /app \
&& chmod -R 755 /app \
&& chown -R root:root /app && chmod -R 755 /app \
&& apk del --purge .build-deps \
&& rm -rf \
/root/.cache \
/root/.cargo \
/tmp/*
&& rm -rf /root/.cache /root/.cargo /tmp/*

COPY ./apps/bazarr/entrypoint.sh /entrypoint.sh
COPY --from=ghcr.io/linuxserver/unrar:7.0.9 /usr/bin/unrar-alpine /usr/bin/unrar
COPY --from=ghcr.io/linuxserver/unrar:latest /usr/bin/unrar-alpine /usr/bin/unrar

USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/morpheus65535/bazarr"
4 changes: 2 additions & 2 deletions apps/bazarr/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

#shellcheck disable=SC2086

exec \
/usr/local/bin/python \
/app/bin/bazarr.py \
--no-update \
--config /config \
--port ${BAZARR__PORT:-6767} \
--port ${BAZARR__PORT} \
"$@"
19 changes: 5 additions & 14 deletions apps/home-assistant/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ENV \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_BREAK_SYSTEM_PACKAGES=1 \
CRYPTOGRAPHY_DONT_BUILD_RUST=1 \
HOMEASSISTANT_WHEELS="https://wheels.home-assistant.io/musllinux/" \
HOME="/config"

Expand Down Expand Up @@ -96,26 +97,16 @@ RUN \
&& \
uv pip install --system --only-binary=:all: --find-links "${HOMEASSISTANT_WHEELS}" \
homeassistant=="${VERSION}" \
&& \
mkdir -p /config \
&& chown nobody:nogroup -R /config \
&& \
pip uninstall --yes uv \
&& \
apk del --purge .build-deps \
&& \
rm -rf \
/root/.cache \
/root/.cargo \
/tmp/*
&& mkdir -p /config && chown nobody:nogroup -R /config \
&& pip uninstall --yes uv && apk del --purge .build-deps \
&& rm -rf /root/.cache /root/.cargo /tmp/*

COPY ./apps/home-assistant/entrypoint.sh /entrypoint.sh

USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/home-assistant/core"
1 change: 1 addition & 0 deletions apps/home-assistant/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
#shellcheck disable=SC2086

if [[ "${HOME_ASSISTANT__HACS_INSTALL}" == "true" ]]; then
curl -sfSL https://get.hacs.xyz | bash -
Expand Down
17 changes: 6 additions & 11 deletions apps/jbops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ ENV \
PIP_BREAK_SYSTEM_PACKAGES=1 \
CRYPTOGRAPHY_DONT_BUILD_RUST=1

ENV PLEXAPI_CONFIG_PATH="/config/config.ini" \
JBOPS__SCRIPT_PATH="fun/plexapi_haiku.py"

ENV UMASK="0002" \
TZ="Etc/UTC"

ENV PLEXAPI_CONFIG_PATH="/config/config.ini" \
JBOPS__SCRIPT_PATH="fun/plexapi_haiku.py"

USER root
WORKDIR /app

Expand Down Expand Up @@ -49,19 +49,14 @@ RUN apk add --no-cache \
fi \
&& \
pip install --upgrade --requirement requirements.txt \
&& chown -R root:root /app && chmod -R 755 /app \
&& apk del --purge .build-deps \
&& chown -R root:root /app \
&& chmod -R 755 /app \
&& rm -rf \
/root/.cache \
/root/.cargo \
/tmp/*
&& rm -rf /root/.cache /root/.cargo /tmp/*

COPY ./apps/jbops/entrypoint.sh /entrypoint.sh

USER nobody:nogroup

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/blacktwin/JBOPS"
1 change: 1 addition & 0 deletions apps/jbops/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
#shellcheck disable=SC2086

exec \
/usr/local/bin/python \
Expand Down
16 changes: 5 additions & 11 deletions apps/plex/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
ARG VERSION
ARG CHANNEL

ENV DEBCONF_NONINTERACTIVE_SEEN="true" \

Check warning on line 7 in apps/plex/Dockerfile

View workflow job for this annotation

GitHub Actions / build-images / Build/Test plex (linux/amd64)

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 7 in apps/plex/Dockerfile

View workflow job for this annotation

GitHub Actions / build-images / Build/Test plex-beta (linux/amd64)

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
DEBIAN_FRONTEND="noninteractive" \
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE="DontWarn"

ENV UMASK="0002" \
TZ="Etc/UTC"

ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
PLEX_MEDIA_SERVER_INFO_VENDOR="Docker" \
PLEX_MEDIA_SERVER_INFO_DEVICE="Docker Container (onedr0p)"

ENV UMASK="0002" \
TZ="Etc/UTC"

USER root
WORKDIR /app

Expand Down Expand Up @@ -55,18 +55,12 @@
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt-get autoremove -y \
&& apt-get clean \
&& \
rm -rf \
/etc/default/plexmediaserver \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/
&& rm -rf /etc/default/plexmediaserver /tmp/* /var/lib/apt/lists/* /var/tmp/

COPY ./apps/plex/entrypoint.sh /entrypoint.sh

USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]

ENTRYPOINT [ "/usr/bin/catatonit", "--" ]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]
4 changes: 1 addition & 3 deletions apps/plex/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash
#shellcheck disable=SC2086,SC2155

#shellcheck disable=SC2155
export PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m)
#shellcheck disable=SC2155
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r)

function getPref {
Expand Down Expand Up @@ -110,7 +109,6 @@ if [[ "${PLEX_PURGE_CODECS}" == "true" ]]; then
find "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server/Codecs" -mindepth 1 -not -name '.device-id' -print -delete
fi

#shellcheck disable=SC2086
exec \
/usr/lib/plexmediaserver/Plex\ Media\ Server \
"$@"
5 changes: 3 additions & 2 deletions apps/postgres-init/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ RUN \

COPY ./apps/postgres-init/entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]
USER nobody:nogroup

ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/postgres/postgres"
25 changes: 9 additions & 16 deletions apps/prowlarr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ ARG TARGETPLATFORM
ARG VERSION
ARG CHANNEL

ENV UMASK="0002" \
TZ="Etc/UTC"

ENV \
COMPlus_EnableDiagnostics="0" \
PROWLARR__UPDATE__BRANCH="${CHANNEL}"

ENV UMASK="0002" \
TZ="Etc/UTC"

USER root
WORKDIR /app

Expand All @@ -36,26 +36,19 @@ RUN \
'linux/amd64') export ARCH='x64' ;; \
'linux/arm64') export ARCH='arm64' ;; \
esac \
&& \
mkdir -p /app/bin \
&& \
curl -fsSL "https://prowlarr.servarr.com/v1/update/${PROWLARR__UPDATE__BRANCH}/updatefile?version=${VERSION}&os=linuxmusl&runtime=netcore&arch=${ARCH}" \
&& mkdir -p /app/bin \
&& curl -fsSL "https://prowlarr.servarr.com/v1/update/${PROWLARR__UPDATE__BRANCH}/updatefile?version=${VERSION}&os=linuxmusl&runtime=netcore&arch=${ARCH}" \
| tar xzf - -C /app/bin --strip-components=1 \
&& \
rm -rf /app/bin/Prowlarr.Update \
&& \
printf "UpdateMethod=docker\nBranch=%s\nPackageVersion=%s\nPackageAuthor=[onedr0p](https://github.com/onedr0p)\n" "${PROWLARR__UPDATE__BRANCH}" "${VERSION}" > /app/package_info \
&& chown -R root:root /app \
&& chmod -R 755 /app \
&& rm -rf /tmp/*
&& printf "UpdateMethod=docker\nBranch=%s\nPackageVersion=%s\nPackageAuthor=[onedr0p](https://github.com/onedr0p)\n" "${PROWLARR__UPDATE__BRANCH}" "${VERSION}" > /app/package_info \
&& chown -R root:root /app && chmod -R 755 /app \
&& rm -rf /tmp/* /app/bin/Prowlarr.Update

COPY ./apps/prowlarr/entrypoint.sh /entrypoint.sh

USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/Prowlarr/Prowlarr"
2 changes: 1 addition & 1 deletion apps/prowlarr/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

#shellcheck disable=SC2086

exec \
/app/bin/Prowlarr \
--nobrowser \
Expand Down
15 changes: 6 additions & 9 deletions apps/qbittorrent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ ARG TARGETPLATFORM
ARG VERSION
ARG CHANNEL

ENV QBT_CONFIRM_LEGAL_NOTICE=1 \
QBT_WEBUI_PORT=8080 \
QBT_TORRENTING_PORT=50413

ENV UMASK="0002" \
TZ="Etc/UTC"

ENV HOME="/config" \
ENV QBT_CONFIRM_LEGAL_NOTICE=1 \
QBT_WEBUI_PORT=8080 \
QBT_TORRENTING_PORT=50413 \
HOME="/config" \
XDG_CONFIG_HOME="/config" \
XDG_DATA_HOME="/config"

Expand Down Expand Up @@ -53,8 +52,7 @@ RUN \
&& curl -fsSL -o /app/qbittorrent-nox "https://github.com/userdocs/qbittorrent-nox-static/releases/download/${RELEASE}/${ARCH}-qbittorrent-nox" \
;; \
esac \
&& \
chown -R root:root /app/qbittorrent-nox \
&& chown -R root:root /app/qbittorrent-nox \
&& chmod -R 755 /app/qbittorrent-nox \
&& rm -rf /tmp/*

Expand All @@ -65,7 +63,6 @@ USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/qbittorrent/qBittorrent"
25 changes: 9 additions & 16 deletions apps/radarr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ ARG TARGETPLATFORM
ARG VERSION
ARG CHANNEL

ENV UMASK="0002" \
TZ="Etc/UTC"

ENV \
COMPlus_EnableDiagnostics="0" \
RADARR__UPDATE__BRANCH="${CHANNEL}"

ENV UMASK="0002" \
TZ="Etc/UTC"

USER root
WORKDIR /app

Expand All @@ -36,26 +36,19 @@ RUN \
'linux/amd64') export ARCH='x64' ;; \
'linux/arm64') export ARCH='arm64' ;; \
esac \
&& \
mkdir -p /app/bin \
&& \
curl -fsSL "https://radarr.servarr.com/v1/update/${RADARR__UPDATE__BRANCH}/updatefile?version=${VERSION}&os=linuxmusl&runtime=netcore&arch=${ARCH}" \
&& mkdir -p /app/bin \
&& curl -fsSL "https://radarr.servarr.com/v1/update/${RADARR__UPDATE__BRANCH}/updatefile?version=${VERSION}&os=linuxmusl&runtime=netcore&arch=${ARCH}" \
| tar xzf - -C /app/bin --strip-components=1 \
&& \
rm -rf /app/bin/Radarr.Update \
&& \
printf "UpdateMethod=docker\nBranch=%s\nPackageVersion=%s\nPackageAuthor=[onedr0p](https://github.com/onedr0p)\n" "${RADARR__UPDATE__BRANCH}" "${VERSION}" > /app/package_info \
&& chown -R root:root /app \
&& chmod -R 755 /app \
&& rm -rf /tmp/*
&& printf "UpdateMethod=docker\nBranch=%s\nPackageVersion=%s\nPackageAuthor=[onedr0p](https://github.com/onedr0p)\n" "${RADARR__UPDATE__BRANCH}" "${VERSION}" > /app/package_info \
&& chown -R root:root /app && chmod -R 755 /app \
&& rm -rf /tmp/* /app/bin/Radarr.Update

COPY ./apps/radarr/entrypoint.sh /entrypoint.sh

USER nobody:nogroup
WORKDIR /config
VOLUME ["/config"]

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]

LABEL org.opencontainers.image.source="https://github.com/Radarr/Radarr"
2 changes: 1 addition & 1 deletion apps/radarr/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

#shellcheck disable=SC2086

exec \
/app/bin/Radarr \
--nobrowser \
Expand Down
Loading
Loading