entrypoint logic

This commit is contained in:
Alexandre
2021-11-13 13:02:39 +01:00
parent 2acb25daf8
commit 11b402cb10
16 changed files with 144 additions and 76 deletions

View File

@@ -31,16 +31,16 @@ RUN \
######################################## ########################################
# Correct upstream image folders links # # Correct upstream image folders links #
######################################## ########################################
&& mkdir -p -m 777 /config/filebrowser && mkdir -p -m 777 /config/filebrowser || true
# Copy root filesystem # Copy root filesystem
COPY rootfs / COPY rootfs /
VOLUME [ "/data" ] VOLUME [ "/data" ]
WORKDIR / WORKDIR /
RUN chmod 777 /run.sh RUN chmod 777 /entrypoint.sh
ENTRYPOINT [ "/usr/bin/env" ] ENTRYPOINT [ "/usr/bin/env" ]
CMD [ "/run.sh" ] CMD [ "/entrypoint.sh" ]
### LABELS ### LABELS

View File

@@ -0,0 +1,12 @@
#!/bin/bash
cd /scripts
for SCRIPTS in *; do
[ -e "$SCRIPTS" ] || continue
echo $SCRIPTS
chown $(id -u):$(id -g) $SCRIPTS
chmod a+x $SCRIPTS
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS || true
./$SCRIPTS &&
true || true # Prevents script crash on failure
done

View File

@@ -0,0 +1,36 @@
#!/bin/bash
if [ ! -f "/usr/bin/bashio" ]; then
echo "Bashio does not exist, executing script"
################
# Install apps #
################
apk add --no-cache \
curl \
jq \
bash \
cifs-utils \
keyutils \
samba \
samba-client \
bind-tools \
nginx
###################
# Install bashio #
##################
BASHIO_VERSION=0.13.1
mkdir -p /tmp/bashio
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" |
tar -xzf - --strip 1 -C /tmp/bashio
mv /tmp/bashio/lib /usr/lib/bashio
ln -s /usr/lib/bashio/bashio /usr/bin/bashio
rm -rf /tmp/bashio
########################################
# Correct upstream image folders links #
########################################
mkdir -p -m 777 /config/filebrowser || true
echo "Bashio installed"
fi

View File

@@ -1,18 +1,5 @@
#!/usr/bin/env bashio #!/usr/bin/env bashio
###########
# SCRIPTS #
###########
for SCRIPTS in "/00-banner.sh" "/92-local_mounts.sh" "/92-smb_mounts.sh"; do
echo $SCRIPTS
chown $(id -u):$(id -g) $SCRIPTS
chmod a+x $SCRIPTS
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS
/.$SCRIPTS &&
true # Prevents script crash on failure
done
################### ###################
# SSL CONFIG v1.0 # # SSL CONFIG v1.0 #
################### ###################

View File

@@ -27,9 +27,9 @@ RUN \
VOLUME [ "/data" ] VOLUME [ "/data" ]
WORKDIR / WORKDIR /
RUN chmod 777 /run.sh RUN chmod 777 /entrypoint.sh
ENTRYPOINT [ "/bin/bash" ] ENTRYPOINT [ "/bin/bash" ]
CMD [ "/run.sh" ] CMD [ "/entrypoint.sh" ]
# use /data instead of /config for hass.io environment # use /data instead of /config for hass.io environment
# && sed -i "s|/config|/share/freqtrade|g" /etc/services.d/freqtrade/run \ # && sed -i "s|/config|/share/freqtrade|g" /etc/services.d/freqtrade/run \

View File

@@ -0,0 +1,13 @@
#!/bin/bash
echo "Starting"
if [ ! -f /data/config.json ]; then
echo "building userdir"
freqtrade create-userdir --userdir /data
echo "building initial config"
freqtrade new-config --config /data/config.json
fi
echo "Starting app"
freqtrade trade --logfile /data/logs/freqtrade.log --db-url sqlite://///data/tradesv3.sqlite --config /data/config.json --strategy SampleStrategy

View File

@@ -129,8 +129,7 @@ if [ $VERBOSE = true ]; then
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN
else else
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN >/dev/null nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN >/dev/null
fi \ fi &
&
bashio::log.info "Please wait, loading..." bashio::log.info "Please wait, loading..."
# Wait for transmission to become available # Wait for transmission to become available

View File

@@ -8,7 +8,6 @@ COPY rootfs /
ARG BASHIO_VERSION=0.13.1 ARG BASHIO_VERSION=0.13.1
ENV WEBTREES_HOME="/data/webtrees" ENV WEBTREES_HOME="/data/webtrees"
WORKDIR $WEBTREES_HOME WORKDIR $WEBTREES_HOME
ENTRYPOINT ["/run.sh"]
VOLUME ["/data"] VOLUME ["/data"]
RUN \ RUN \
@@ -36,14 +35,16 @@ RUN \
# Modify image # # Modify image #
################ ################
# Change data location # Change data location
&& grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' \ && grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' || true
\
# Add entry script # Add entry script
&& chown root:root /run.sh \ RUN chown root:root /entrypoint.sh \
&& chmod a+x /run.sh \ && chmod 777 /entrypoint.sh \
# Add end script # Add end script
&& sed -i '$ d' /docker-entrypoint.sh && sed -i '$ d' /docker-entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
### LABELS ### LABELS
ARG BUILD_ARCH ARG BUILD_ARCH
ARG BUILD_DATE ARG BUILD_DATE

View File

@@ -1,4 +1,4 @@
#!/bin/bah #!/bin/bash
echo "Starting" echo "Starting"

View File

@@ -0,0 +1,33 @@
#!/bin/bash
if [ ! -f "/usr/bin/bashio" ]; then
echo "Bashio does not exist, executing script"
################
# Install apps #
################
apt-get clean &&
apt-get update &&
apt-get install -y \
jq \
curl &&
apt-get clean
################
# Modify image #
################
# Change data location
grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g'
###################
# Install bashio #
##################
BASHIO_VERSION=0.13.1
mkdir -p /tmp/bashio
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" |
tar -xzf - --strip 1 -C /tmp/bashio
mv /tmp/bashio/lib /usr/lib/bashio
ln -s /usr/lib/bashio/bashio /usr/bin/bashio
rm -rf /tmp/bashio
echo "Bashio installed"
fi

View File

@@ -1,18 +1,5 @@
#!/usr/bin/env bashio #!/usr/bin/env bashio
###########
# SCRIPTS #
###########
for SCRIPTS in "/00-banner.sh"; do
echo $SCRIPTS
chown $(id -u):$(id -g) $SCRIPTS
chmod a+x $SCRIPTS
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS
/.$SCRIPTS &&
true # Prevents script crash on failure
done
#################### ####################
# GLOBAL VARIABLES # # GLOBAL VARIABLES #
#################### ####################