Skip to content

Commit bd84463

Browse files
committed
improve Dockerfile build sequence
1 parent a1199cc commit bd84463

File tree

5 files changed

+30
-19
lines changed

5 files changed

+30
-19
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
/vendor
3+
/docs

Dockerfile

+14-11
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,21 @@ RUN apt -o Dpkg::Options::="--force-confdef" -y install software-properties-comm
4444
php libapache2-mod-php php-json php-mysql php-curl php-gd php-imap php-xml php-opcache php-soap php-xmlrpc \
4545
php-common php-dev php-zip php-ssh2 php-mbstring php-ldap php-yaml php-snmp && apt -y remove brltty
4646

47-
COPY install/install.sh /tmp/
48-
RUN sh /tmp/install.sh -s 1 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
49-
RUN sh /tmp/install.sh -s 2 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
50-
RUN sh /tmp/install.sh -s 3 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
51-
RUN sh /tmp/install.sh -s 4 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
52-
RUN sh /tmp/install.sh -s 5 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
47+
COPY --chown=root:root --chmod=550 install/install.sh /root/
48+
RUN sh /root/install.sh -s 1 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
49+
RUN sh /root/install.sh -s 2 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
50+
RUN sh /root/install.sh -s 3 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
51+
RUN sh /root/install.sh -s 4 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
52+
RUN sh /root/install.sh -s 5 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
5353
COPY . ${WEBSERVER_HOME}
54-
RUN sh /tmp/install.sh -s 7 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
55-
RUN sh /tmp/install.sh -s 8 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
56-
RUN sh /tmp/install.sh -s 9 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
57-
RUN sh /tmp/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
58-
RUN sh /tmp/install.sh -s 11 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
54+
RUN sh /root/install.sh -s 7 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
55+
RUN sh /root/install.sh -s 8 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
56+
RUN sh /root/install.sh -s 9 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
57+
# step_10_jeedom_installation : install composer
58+
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
59+
RUN composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts --optimize-autoloader
60+
# RUN sh /root/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
61+
RUN sh /root/install.sh -s 11 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker
5962
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
6063
RUN echo >${WEBSERVER_HOME}/initialisation
6164

composer.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/OS_specific/Docker/init.sh

+9-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ if [ -f ${WEBSERVER_HOME}/core/config/common.config.php ]; then
8181
else
8282
echo 'Start jeedom installation'
8383
JEEDOM_INSTALL=0
84-
rm -rf /root/install.sh
85-
wget https://raw.githubusercontent.com/jeedom/core/${VERSION}/install/install.sh -O /root/install.sh
86-
chmod +x /root/install.sh
87-
/root/install.sh -s 6 -v ${VERSION} -w ${WEBSERVER_HOME}
84+
85+
# do not re-install jeedom
86+
if [ ! -f ${WEBSERVER_HOME}/core/config/common.config.sample.php ]; then
87+
echo 'download again Jeedom'
88+
/root/install.sh -s 6 -v ${VERSION} -w ${WEBSERVER_HOME}
89+
# jeedom installation : install composer
90+
/root/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} -i docker
91+
fi
92+
8893
if [ $(which mysqld | wc -l) -ne 0 ]; then
8994
chown -R mysql:mysql /var/lib/mysql
9095
mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/

install/install.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,6 @@ step_10_jeedom_installation() {
331331
export COMPOSER_ALLOW_SUPERUSER=1
332332
cd ${WEBSERVER_HOME}
333333
composer install --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts --optimize-autoloader
334-
mkdir -p /tmp/jeedom
335-
chmod 777 -R /tmp/jeedom
336-
chown www-data:www-data -R /tmp/jeedom
337334

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

0 commit comments

Comments
 (0)