Switch to 1.8.2

This commit is contained in:
Alexandre
2022-11-01 18:58:37 +01:00
parent e2c322ec71
commit c6f80bdd16
10 changed files with 99 additions and 73 deletions

View File

@@ -27,25 +27,6 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_SERVICES_GRACETIME=0
# Global LSIO modifications
ARG CONFIGLOCATION="/config/addons_config/paperless_ng"
# hadolint ignore=SC2015, SC2013, SC2086
RUN \
# Avoid custom-init.d duplications
for file in $(grep -sril 'Potential tampering with custom' /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d); do rm -f $file; done \
\
# Create new config folder if needed
&& for file in $(grep -srl "PUID" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i "1a mkdir -p $CONFIGLOCATION" $file; done \
\
# Allow UID and GID setting
&& for file in $(grep -srl "PUID" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i 's/bash/bashio/g' $file && sed -i '1a PUID="$(if bashio::config.has_value "PUID"; then bashio::config "PUID"; else echo "0"; fi)"' $file && sed -i '1a PGID="$(if bashio::config.has_value "PGID"; then bashio::config "PGID"; else echo "0"; fi)"' $file; done \
\
# Correct config location
&& for file in $(grep -Esril "/config[ '\"/]|/config\$" /etc /defaults); do sed -Ei "s=(/config)+(/| |$|\"|\')=$CONFIGLOCATION\2=g" $file; done \
\
# Avoid chmod /config
&& for file in /etc/services.d/*/* /etc/cont-init.d/* /etc/s6-overlay/s6-rc.d/*/*;do if [ -f $files ] && [[ ! -z $(awk '/chown.*abc:abc.*\\/,/.*\/config( |$)/{print FILENAME}' $file) ]] ; then sed -i "s|/config$|/data|g" $file; fi ;done
##################
# 3 Install apps #
##################
@@ -58,6 +39,24 @@ RUN if [ -d /etc/cont-init.d ]; then chmod -R 755 /etc/cont-init.d; fi && \
if [ -d /etc/services.d ]; then chmod -R 755 /etc/services.d; fi && \
if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi
ENV \
PAPERLESS_DATA_DIR=/config/addons_config/paperless_ng \
PAPERLESS_MEDIA_ROOT=/config/addons_config/paperless_ng/media \
PAPERLESS_CONSUMPTION_DIR=/config/addons_config/paperless_ng/consume
# Modify image
RUN \
sed -i 's|usr/bin/env bash|usr/bin/env bashio|g' /sbin/docker-entrypoint.sh && \
# Run entrypoint
sed -i '2i /./entrypoint.sh' /sbin/docker-entrypoint.sh && \
# Set variables
sed -i '2i bashio::log.info "Defining variables"' /sbin/docker-entrypoint.sh && \
sed -i '2i if bashio::config.has_value "PUID"; then export USERMAP_UID=$(bashio::config "PUID"); fi' /sbin/docker-entrypoint.sh && \
sed -i '2i if bashio::config.has_value "PGID"; then export USERMAP_GID=$(bashio::config "PGID"); fi' /sbin/docker-entrypoint.sh && \
sed -i '2i if bashio::config.has_value "TZ"; then export PAPERLESS_TIME_ZONE=$(bashio::config "TZ"); fi' /sbin/docker-entrypoint.sh && \
sed -i '2i if bashio::config.has_value "OCRLANG"; then export PAPERLESS_OCR_LANGUAGES=$(bashio::config "OCRLANG"); fi' /sbin/docker-entrypoint.sh && \
sed -i '2i if bashio::config.has_value "PAPERLESS_OCR_MODE"; then export PAPERLESS_OCR_MODE=$(bashio::config "PAPERLESS_OCR_MODE"); fi' /sbin/docker-entrypoint.sh
# Modules
ARG MODULES="00-banner.sh 92-local_mounts.sh 92-smb_mounts.sh 90-config_yaml.sh"
@@ -70,9 +69,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
&& chmod -R 755 /etc/cont-init.d || printf '%s\n' "${MODULES}" >/MODULESFILE
# Manual apps
ENV PACKAGES="yamllint \
pip \
libxml2-dev libxslt-dev python-dev libjpeg-dev zlib1g-dev python3-dev build-essential"
ENV PACKAGES="redis-server yamllint pip libxml2-dev libxslt-dev python-dev libjpeg-dev zlib1g-dev python3-dev build-essential"
# Automatic apps & bashio
# hadolint ignore=SC2015
@@ -88,10 +85,10 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
# 4 Entrypoint #
################
#RUN chmod 777 /entrypoint.sh
RUN chmod 777 /entrypoint.sh
#WORKDIR /
#ENTRYPOINT [ "/usr/bin/env" ]
#CMD [ "/entrypoint.sh" ]
#ENTRYPOINT [ "/entrypoint.sh" ]
#SHELL ["/bin/bash", "-o", "pipefail", "-c"]
############