summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-10-01 19:30:54 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-10-01 19:30:54 +0200
commit79c76eaef5039276bb3a8725ac8c9f05f89ef0de (patch)
tree1bde68d36ce44d75fafc6dfb41f5f6d2b555815f
parentbc1b77dc912adfd040d432972e2d3256c9ea2065 (diff)
downloadadei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.gz
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.bz2
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.tar.xz
adei-79c76eaef5039276bb3a8725ac8c9f05f89ef0de.zip
Optimize Dockerfile
-rw-r--r--adei/Dockerfile91
-rwxr-xr-xadei/files/docker-entrypoint.sh (renamed from adei/docker-entrypoint.sh)2
-rw-r--r--adei/files/etc/supervisord.conf (renamed from adei/supervisor/supervisord.conf)0
-rwxr-xr-xadei/files/openshift-entrypoint.sh (renamed from adei/openshift-entrypoint.sh)3
-rw-r--r--adei/files/opt/configs/apache.conf (renamed from adei/configs/apache.conf)0
-rw-r--r--adei/files/opt/configs/config.actual.php (renamed from adei/configs/config.actual.php)0
-rw-r--r--adei/files/opt/configs/config.override.php (renamed from adei/configs/config.override.php)0
-rw-r--r--adei/files/opt/configs/passwd.admin (renamed from adei/configs/passwd.admin)0
-rw-r--r--adei/files/opt/configs/passwd.user (renamed from adei/configs/passwd.user)0
-rwxr-xr-xadei/files/opt/scripts/adei-branch.sh (renamed from adei/scripts/adei-branch.sh)0
-rwxr-xr-xadei/files/opt/scripts/configure.sh (renamed from adei/scripts/configure.sh)0
-rwxr-xr-xadei/files/opt/scripts/log.sh (renamed from adei/scripts/log.sh)0
-rw-r--r--adei/files/opt/scripts/override.sed (renamed from adei/scripts/override.sed)0
-rwxr-xr-xadei/files/opt/scripts/run-apache.sh (renamed from adei/scripts/run-apache.sh)0
-rwxr-xr-xadei/files/opt/scripts/run-cron.sh (renamed from adei/scripts/run-cron.sh)2
-rw-r--r--docker-compose.yml22
16 files changed, 53 insertions, 67 deletions
diff --git a/adei/Dockerfile b/adei/Dockerfile
index 0428a08..e134875 100644
--- a/adei/Dockerfile
+++ b/adei/Dockerfile
@@ -1,46 +1,56 @@
-FROM opensuse:42.3
+FROM opensuse/leap:42.3
MAINTAINER Suren A. Chilingaryan <csa@suren.me>
-# Useful system applications
-RUN zypper -n in glibc-locale mc bzr git openssh telnet curl python-pycurl
-
-ENV LANG en_US.UTF-8
-ENV LANGUAGE en_US:en
-ENV LC_ALL en_US.UTF-8
+EXPOSE 80
+VOLUME /adei
+
+ENV ADEI_REVISION=last:1 \
+ ADEI_PARALLEL=sources \
+ ADEI_SETUP=all \
+ ADEI_ENABLED_SETUPS="autogen logs" \
+ ADEI_PORTS=80 \
+ APACHE_SERVERS=0 \
+ MYSQL_SERVER=adei-mysql \
+ MYSQL_PORT=3306 \
+ MYSQL_USER=adei \
+ MYSQL_PASSWORD=adei \
+ MYSQL_DATABASE=adei \
+ LANG=en_US.UTF-8 \
+ LANGUAGE=en_US:en \
+ LC_ALL=en_US.UTF-8
+
+COPY files/ /
# Installation of ADEI & dependencies
RUN zypper ar http://download.opensuse.org/repositories/home:/csa7fff:/adei/openSUSE_Leap_42.3/home:csa7fff:adei.repo && \
zypper ar http://download.opensuse.org/repositories/server:/php:/extensions/openSUSE_Leap_42.3/server:php:extensions.repo && \
zypper ar http://download.opensuse.org/repositories/devel:languages:python/openSUSE_Tumbleweed/devel:languages:python.repo && \
zypper --gpg-auto-import-keys ref -s && \
+ zypper -n in glibc-locale mc bzr git openssh telnet curl python-pycurl && \
zypper -n in supervisor procmail alpine which w3m && \
zypper -n in perl perl-DateTime-Format-Strptime mailx && \
zypper -n in make java && \
zypper -n in adei adei-config-default adei-req-mssql adei-webroot php-pecl-rrd && \
- zypper -n in bzr-webdav
-
-VOLUME /var/log/apache2
-VOLUME /var/spool/mail
-
-VOLUME /adei/src
-VOLUME /adei/cfg
-VOLUME /adei/tmp
-VOLUME /adei/sys
-
-
-COPY supervisor/supervisord.conf /etc/supervisord.conf
-
-# Apply configuration changes
-COPY configs /opt/configs
-COPY scripts /opt/scripts
-RUN /opt/scripts/configure.sh
-
+ zypper -n in bzr-webdav && \
+ \
+ bash -c 'mkdir -p /adei/{src,cfg,tmp,sys,log,mail}' && \
+ /opt/scripts/configure.sh && \
+ \
# Replace packaged ADEI with repository version
-RUN rm -rf /srv/www/htdocs/adei && \
- ln -s /adei/src /srv/www/htdocs/adei
-
+ rm -rf /srv/www/htdocs/adei && \
+ ln -s /adei/src /srv/www/htdocs/adei && \
+ for name in $(find /srv -mindepth 1 -maxdepth 1 -name '*.sh'); do rm "$name"; ln -s "/adei/src/scripts/cron/$(basename $name)" "$name"; done && \
+ rm -f /etc/cron.d/adei.cron && \
+ ln -s /adei/src/scripts/cron/adei.cron /etc/cron.d/adei.cron && \
+ \
+# Consolidate all volumes in /adei
+ rm -rf /var/log/apache2 && \
+ ln -s /adei/log /var/log/apache2 && \
+ rm -rf /var/spool/mail && \
+ ln -s /adei/mail /var/spool/mail && \
+ \
# Modify for non-priviledged mode
-RUN chmod +rx /etc/php5/conf.d && \
+ chmod +rx /etc/php5/conf.d && \
ln -sf /etc/mime.types /etc/apache2/mime.types && \
find /etc/apache2 -type d -exec chmod +rx '{}' \; && \
chmod -R +r /etc/apache2 && \
@@ -49,27 +59,10 @@ RUN chmod +rx /etc/php5/conf.d && \
mkdir -p /etc/apache2/sysconfig.d && \
chmod a+rwx /etc/apache2/sysconfig.d && \
sed -i'' -re 's@/var/run@/tmp@' /usr/sbin/start_apache2 && \
- chmod +x /usr/sbin/start_apache2
-
+ chmod +x /usr/sbin/start_apache2 && \
+ \
# Ugly python needs to resolve user name
-RUN chmod g=u /etc/passwd
-
-ENV MYSQL_SERVER adei-mysql
-ENV MYSQL_PORT 3306
-ENV MYSQL_USER adei
-ENV MYSQL_PASSWORD adei
-ENV MYSQL_DATABASE adei
-
-ENV ADEI_REVISION last:1
-ENV ADEI_PARALLEL sources
-ENV ADEI_SETUP all
-ENV ADEI_ENABLED_SETUPS autogen logs
-ENV ADEI_PORTS 80
+ chmod g=u /etc/passwd
-ENV APACHE_SERVERS 0
-
-COPY *-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
-
-EXPOSE 80
CMD /usr/bin/supervisord -c /etc/supervisord.conf
diff --git a/adei/docker-entrypoint.sh b/adei/files/docker-entrypoint.sh
index f4d9f20..1e99d15 100755
--- a/adei/docker-entrypoint.sh
+++ b/adei/files/docker-entrypoint.sh
@@ -2,6 +2,8 @@
set -e
+mkdir -p /adei/{src,cfg,tmp,sys,log,mail}
+
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
diff --git a/adei/supervisor/supervisord.conf b/adei/files/etc/supervisord.conf
index 53a6dcd..53a6dcd 100644
--- a/adei/supervisor/supervisord.conf
+++ b/adei/files/etc/supervisord.conf
diff --git a/adei/openshift-entrypoint.sh b/adei/files/openshift-entrypoint.sh
index b4fc4f4..6dde9a8 100755
--- a/adei/openshift-entrypoint.sh
+++ b/adei/files/openshift-entrypoint.sh
@@ -1,5 +1,8 @@
#! /bin/bash
+mkdir -p /adei/{src,cfg,tmp,sys,log,mail}
+
+
while [ ! -f /adei/cfg/.ready ]; do
echo "Waiting for ADEI intialization..."
sleep 5
diff --git a/adei/configs/apache.conf b/adei/files/opt/configs/apache.conf
index 87e3c87..87e3c87 100644
--- a/adei/configs/apache.conf
+++ b/adei/files/opt/configs/apache.conf
diff --git a/adei/configs/config.actual.php b/adei/files/opt/configs/config.actual.php
index acb6c35..acb6c35 100644
--- a/adei/configs/config.actual.php
+++ b/adei/files/opt/configs/config.actual.php
diff --git a/adei/configs/config.override.php b/adei/files/opt/configs/config.override.php
index e69de29..e69de29 100644
--- a/adei/configs/config.override.php
+++ b/adei/files/opt/configs/config.override.php
diff --git a/adei/configs/passwd.admin b/adei/files/opt/configs/passwd.admin
index 1a7a4bb..1a7a4bb 100644
--- a/adei/configs/passwd.admin
+++ b/adei/files/opt/configs/passwd.admin
diff --git a/adei/configs/passwd.user b/adei/files/opt/configs/passwd.user
index 1a7a4bb..1a7a4bb 100644
--- a/adei/configs/passwd.user
+++ b/adei/files/opt/configs/passwd.user
diff --git a/adei/scripts/adei-branch.sh b/adei/files/opt/scripts/adei-branch.sh
index e56f792..e56f792 100755
--- a/adei/scripts/adei-branch.sh
+++ b/adei/files/opt/scripts/adei-branch.sh
diff --git a/adei/scripts/configure.sh b/adei/files/opt/scripts/configure.sh
index 458c3dc..458c3dc 100755
--- a/adei/scripts/configure.sh
+++ b/adei/files/opt/scripts/configure.sh
diff --git a/adei/scripts/log.sh b/adei/files/opt/scripts/log.sh
index 4237682..4237682 100755
--- a/adei/scripts/log.sh
+++ b/adei/files/opt/scripts/log.sh
diff --git a/adei/scripts/override.sed b/adei/files/opt/scripts/override.sed
index 7b96a5b..7b96a5b 100644
--- a/adei/scripts/override.sed
+++ b/adei/files/opt/scripts/override.sed
diff --git a/adei/scripts/run-apache.sh b/adei/files/opt/scripts/run-apache.sh
index 202df62..202df62 100755
--- a/adei/scripts/run-apache.sh
+++ b/adei/files/opt/scripts/run-apache.sh
diff --git a/adei/scripts/run-cron.sh b/adei/files/opt/scripts/run-cron.sh
index 5f4b9e2..11958b7 100755
--- a/adei/scripts/run-cron.sh
+++ b/adei/files/opt/scripts/run-cron.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-printenv | grep -v affinity:container | sed -r 's/^(.*)=("?)(.*)\2$/export \1="\3"/g' > /adei/env
+printenv | grep -v affinity:container | sed -r 's/^(.*)=("?)(.*)\2$/export \1="\3"/g' > /tmp/adei.env
/opt/scripts/adei-branch.sh
diff --git a/docker-compose.yml b/docker-compose.yml
index 6c167db..7dbbf8b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -5,13 +5,7 @@ services:
image: chsa/adei:latest
command: /bin/false
volumes:
- - src:/adei/src
- - tmp:/adei/tmp
- - sys:/adei/sys
- - cfg:/adei/cfg
- - ovr:/adei/ovr
- - mail:/var/spool/mail
- - logs:/var/log/apache2
+ - adei:/adei
mysql:
build: ./mysql
@@ -57,7 +51,7 @@ services:
environment:
- ADEI_PORTS=81
ports:
- - 81:80
+ - 81:81
tango_backend:
image: chsa/adei:latest
@@ -89,7 +83,7 @@ services:
- ADEI_PORTS=82
- MYSQL_DATABASE=adei_tango
ports:
- - 82:80
+ - 82:82
debug:
image: chsa/adei:latest
@@ -103,14 +97,8 @@ services:
environment:
- ADEI_ENABLED_SETUPS=autogen
ports:
- - 79:80
+ - 79:79
volumes:
db:
- src:
- tmp:
- cfg:
- sys:
- ovr:
- mail:
- logs:
+ adei: