Compare commits

...

3 Commits

Author SHA1 Message Date
45a88a91f6
feat: added entryPoint to server
Some checks reported errors
continuous-integration/drone/push Build was killed
2024-07-31 22:13:24 +02:00
1b9841e028
fix: added missing ps command to both images 2024-07-31 22:09:14 +02:00
0c85a0c273
fix: amandates is a file not a directory 2024-07-31 21:07:43 +02:00
3 changed files with 129 additions and 6 deletions

View File

@ -5,7 +5,7 @@ ARG AMANDA_VERSION=tag-community-3.5.4
RUN apt-get -qy update && apt-get -qy upgrade RUN apt-get -qy update && apt-get -qy upgrade
RUN apt-get -qy install git libssl-dev make autoconf autoconf-archive automake bash bison \ RUN apt-get -qy install git libssl-dev make autoconf autoconf-archive automake bash bison \
flex perl libperl-dev libglib2.0-dev swig \ flex perl libperl-dev libglib2.0-dev swig \
libtirpc-dev libreadline-dev libxslt1-dev libxml-simple-perl libtirpc-dev libreadline-dev libxslt1-dev libxml-simple-perl procps
WORKDIR /src WORKDIR /src
RUN git clone https://github.com/zmanda/amanda.git && cd amanda && git checkout ${AMANDA_VERSION} && git submodule update --init --recursive RUN git clone https://github.com/zmanda/amanda.git && cd amanda && git checkout ${AMANDA_VERSION} && git submodule update --init --recursive
@ -21,7 +21,7 @@ FROM debian:stable-slim
RUN apt-get -qy update && apt-get -qy upgrade RUN apt-get -qy update && apt-get -qy upgrade
RUN apt-get -qy install git libssl3 bash perl libglib2.0 swig libtirpc3 libreadline8 \ RUN apt-get -qy install git libssl3 bash perl libglib2.0 swig libtirpc3 libreadline8 \
libxslt1.1 libxml-simple-perl libjson-perl openbsd-inetd libxslt1.1 libxml-simple-perl libjson-perl openbsd-inetd procps
RUN apt-get -qy install tini RUN apt-get -qy install tini
@ -41,7 +41,7 @@ RUN cp /usr/local/etc/amanda/amanda-security.conf /usr/local/etc/
RUN chown root:root /usr/local/etc/amanda-security.conf RUN chown root:root /usr/local/etc/amanda-security.conf
RUN mkdir -p /usr/local/var/amanda/gnutar-lists RUN mkdir -p /usr/local/var/amanda/gnutar-lists
RUN mkdir -p /usr/local/var/amanda/amandates RUN touch /usr/local/var/amanda/amandates
RUN chown -R backup:backup /usr/local/var/amanda RUN chown -R backup:backup /usr/local/var/amanda
USER backup USER backup

114
scripts/entryPoint.sh Executable file
View File

@ -0,0 +1,114 @@
#!/bin/bash
write_config_file()
{
FILE=$1
ENGINE=$2
DATABASE=$3
USER=$4
PASS=$5
HOST=$6
if [ -n $HOST ]; then
HOST=";host=${HOST}"
fi
echo '%dbconfig= (' >> $FILE;
echo " connection => \"${ENGINE}:dbname=${DATABASE}${HOST}\"," >> $FILE
echo " user => \"$USER\"," >> $FILE
echo " password => \"$PASS\"" >> $FILE
echo ');' >> $FILE
}
CONFIGDBFILE=/opt/fhem/configDB.conf
LOGDBFILE=/opt/fhem/db.conf
if [ -z ${CONFIG_DATABASE_ENGINE} ]; then
CONFIG_DATABASE_ENGINE=sqlite
if [ -z ${CONFIG_DATABASE} ]; then
CONFIG_DATABASE="/opt/fhem/configDB.db"
fi
fi
if [ -z ${CONFIG_DATABASE} ]; then
echo "please provide CONFIG_DATABASE name"
exit 255
fi
if [ "${CONFIG_DATABASE_ENGINE}" == "sqlite" ]; then
write_config_file "${CONFIGDBFILE}" "SQLite" "${CONFIG_DATABASE}" "" "";
elif [ "${CONFIG_DATABASE_ENGINE}" == "mysql" ]; then
if [ -z ${CONFIG_DATABASE_HOST} ]; then
CONFIG_DATABASE_HOST="localhost"
fi
if [ -z ${CONFIG_DATABASE_USER} ]; then
echo "please provide CONFIG_DATABASE_USER "
exit 255
fi
if [ -z ${CONFIG_DATABASE_PASS} ]; then
echo "please provide CONFIG_DATABASE_PASS"
exit 255
fi
write_config_file "${CONFIGDBFILE}" "mysql" "${CONFIG_DATABASE}" "${CONFIG_DATABASE_USER}" "${CONFIG_DATABASE_PASS}" "${CONFIG_DATABASE_HOST}"
else
echo "unknown database engine provided in CONFIG_DATABASE_ENGINE"
exit 255
fi
if [ -z ${LOG_DATABASE_ENGINE} ]; then
LOG_DATABASE_ENGINE=sqlite
if [ -z ${LOG_DATABASE} ]; then
LOG_DATABASE="/opt/fhem/logdb.db"
fi
fi
if [ -z ${LOG_DATABASE} ]; then
echo "please provide LOG_DATABASE name"
exit 255
fi
if [ "${LOG_DATABASE_ENGINE}" == "sqlite" ]; then
write_config_file "${LOGDBFILE}" "SQLite" "${LOG_DATABASE}" "" ""
elif [ "${LOG_DATABASE_ENGINE}" == "mysql" ]; then
if [ -z ${LOG_DATABASE_HOST} ]; then
CONFIG_DATABASE_HOST="localhost"
fi
if [ -z ${LOG_DATABASE_USER} ]; then
echo "please provide LOG_DATABASE_USER "
exit 255
fi
if [ -z ${LOG_DATABASE_PASS} ]; then
echo "please provide LOG_DATABASE_PASS "
exit 255
fi
write_config_file "${LOGDBFILE}" "mysql" "${LOG_DATABASE}" "${LOG_DATABASE_USER}" "${LOG_DATABASE_PASS}" "${LOG_DATABASE_HOST}"
else
echo "unknown database engine provided in LOG_DATABASE_ENGINE"
exit 255
fi
export FHEM_GLOBALATTR="nofork=1 updateInBackground=1 logfile=/dev/stdout"
cd /opt/fhem || exit 255
./fhem.pl configDB

View File

@ -5,14 +5,13 @@ ARG AMANDA_VERSION=tag-community-3.5.4
RUN apt-get -qy update && apt-get -qy upgrade RUN apt-get -qy update && apt-get -qy upgrade
RUN apt-get -qy install git libssl-dev make autoconf autoconf-archive automake bash bison \ RUN apt-get -qy install git libssl-dev make autoconf autoconf-archive automake bash bison \
flex perl libperl-dev libglib2.0-dev swig \ flex perl libperl-dev libglib2.0-dev swig \
libtirpc-dev libreadline-dev libxslt1-dev libxml-simple-perl libtirpc-dev libreadline-dev libxslt1-dev libxml-simple-perl procps
WORKDIR /src WORKDIR /src
RUN git clone https://github.com/zmanda/amanda.git && cd amanda && git checkout ${AMANDA_VERSION} && git submodule update --init --recursive RUN git clone https://github.com/zmanda/amanda.git && cd amanda && git checkout ${AMANDA_VERSION} && git submodule update --init --recursive
RUN cd amanda && ./autogen RUN cd amanda && ./autogen
RUN cd amanda && ./configure --without-client --without-bsd-security --with-ssl-security --with-ssh-security --with-readline --with-ipv6 --with-user=backup --with-group=backup RUN cd amanda && ./configure --without-client --without-bsd-security --with-ssl-security --with-ssh-security --with-readline --with-ipv6 --with-user=backup --with-group=backup
RUN cd amanda && make RUN cd amanda && make
@ -22,10 +21,20 @@ FROM debian:stable-slim
RUN apt-get -qy update && apt-get -qy upgrade RUN apt-get -qy update && apt-get -qy upgrade
RUN apt-get -qy install git libssl3 bash perl libglib2.0 swig libtirpc3 libreadline8 \ RUN apt-get -qy install git libssl3 bash perl libglib2.0 swig libtirpc3 libreadline8 \
libxslt1.1 libxml-simple-perl libjson-perl libxslt1.1 libxml-simple-perl libjson-perl procps
RUN apt-get -qy install tini
COPY --from=builder /usr/local/ /usr/local/ COPY --from=builder /usr/local/ /usr/local/
RUN mkdir /usr/local/etc/amanda/ssl
RUN mkdir /usr/local/etc/amanda/Backup/
COPY conf/amanda.conf /usr/local/etc/amanda/Backup
RUN chown backup:backup /usr/local/etc/amanda
ENV LD_LIBRARY_PATH /usr/local/share/perl5/site_perl/auto/Amanda/Debug/ ENV LD_LIBRARY_PATH /usr/local/share/perl5/site_perl/auto/Amanda/Debug/
ADD scripts/entryPoint.sh /entryPoint.sh
RUN chmod +x /entryPoint.sh
USER backup USER backup
ENTRYPOINT ["/usr/bin/tini", "--", "/entryPoint.sh"]