Skip to content

Commit

Permalink
improve Dockerfile build sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
pifou25 committed Feb 23, 2025
1 parent a1199cc commit 5e92695
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
/vendor
/docs
25 changes: 14 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@ RUN apt -o Dpkg::Options::="--force-confdef" -y install software-properties-comm
php libapache2-mod-php php-json php-mysql php-curl php-gd php-imap php-xml php-opcache php-soap php-xmlrpc \
php-common php-dev php-zip php-ssh2 php-mbstring php-ldap php-yaml php-snmp && apt -y remove brltty

COPY install/install.sh /tmp/
RUN sh /tmp/install.sh -s 1 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 2 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 3 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 4 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 5 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
COPY --chown=root:root --chmod=550 install/install.sh /root/
RUN sh /root/install.sh -s 1 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 2 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 3 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 4 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 5 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
COPY . ${WEBSERVER_HOME}
RUN sh /tmp/install.sh -s 7 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 8 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 9 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /tmp/install.sh -s 11 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 7 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 8 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 9 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
# step_10_jeedom_installation : install composer
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
RUN composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts --optimize-autoloader
# RUN sh /root/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN sh /root/install.sh -s 11 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN echo >${WEBSERVER_HOME}/initialisation

Expand Down
13 changes: 9 additions & 4 deletions install/OS_specific/Docker/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,15 @@ if [ -f ${WEBSERVER_HOME}/core/config/common.config.php ]; then
else
echo 'Start jeedom installation'
JEEDOM_INSTALL=0
rm -rf /root/install.sh
wget https://raw.githubusercontent.com/jeedom/core/${VERSION}/install/install.sh -O /root/install.sh
chmod +x /root/install.sh
/root/install.sh -s 6 -v ${VERSION} -w ${WEBSERVER_HOME}

# do not re-install jeedom
if [ ! -f ${WEBSERVER_HOME}/core/config/common.config.sample.php ]; then
echo 'download again Jeedom'
/root/install.sh -s 6 -v ${VERSION} -w ${WEBSERVER_HOME}
# jeedom installation : install composer
/root/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} -i docker
fi

if [ $(which mysqld | wc -l) -ne 0 ]; then
chown -R mysql:mysql /var/lib/mysql
mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/
Expand Down
6 changes: 3 additions & 3 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,6 @@ step_10_jeedom_installation() {
export COMPOSER_ALLOW_SUPERUSER=1
cd ${WEBSERVER_HOME}
composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts --optimize-autoloader
mkdir -p /tmp/jeedom
chmod 777 -R /tmp/jeedom
chown www-data:www-data -R /tmp/jeedom

if [ "${INSTALLATION_TYPE}" != "docker" ];then
php ${WEBSERVER_HOME}/install/install.php mode=force
Expand All @@ -349,6 +346,9 @@ step_10_jeedom_installation() {
step_11_jeedom_post() {
echo "---------------------------------------------------------------------"
echo "${YELLOW}Starting step 11 - Jeedom post-install${NORMAL}"
mkdir -p /tmp/jeedom
chmod 777 -R /tmp/jeedom
chown www-data:www-data -R /tmp/jeedom
if [ $(crontab -l | grep jeedom | wc -l) -ne 0 ];then
(echo crontab -l | grep -v "jeedom") | crontab -

Expand Down

0 comments on commit 5e92695

Please sign in to comment.