From 0e5606d4933f469034d693ebd5f333310d6ba0da Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Mon, 22 Oct 2018 18:01:59 +0300 Subject: [PATCH] Changed start.sh to start.py --- core/admin/Dockerfile | 4 ++-- core/admin/start.py | 7 +++++++ core/admin/start.sh | 5 ----- optional/clamav/Dockerfile | 4 ++-- optional/clamav/start.py | 12 ++++++++++++ optional/clamav/start.sh | 10 ---------- 6 files changed, 23 insertions(+), 19 deletions(-) create mode 100755 core/admin/start.py delete mode 100755 core/admin/start.sh create mode 100755 optional/clamav/start.py delete mode 100755 optional/clamav/start.sh diff --git a/core/admin/Dockerfile b/core/admin/Dockerfile index 2e637206..dca42218 100644 --- a/core/admin/Dockerfile +++ b/core/admin/Dockerfile @@ -12,11 +12,11 @@ RUN apk add --no-cache openssl \ COPY mailu ./mailu COPY migrations ./migrations COPY manage.py . -COPY start.sh /start.sh +COPY start.py /start.py RUN pybabel compile -d mailu/translations EXPOSE 80/tcp VOLUME ["/data"] -CMD ["/start.sh"] +CMD python /start.py diff --git a/core/admin/start.py b/core/admin/start.py new file mode 100755 index 00000000..4bd05f26 --- /dev/null +++ b/core/admin/start.py @@ -0,0 +1,7 @@ +#!/usr/bin/python3 + +import os + +os.system("python manage.py advertise") +os.system("python manage.py db upgrade") +os.system("gunicorn -w 4 -b :80 --access-logfile - --error-logfile - --preload mailu:app") \ No newline at end of file diff --git a/core/admin/start.sh b/core/admin/start.sh deleted file mode 100755 index 8208e4a1..00000000 --- a/core/admin/start.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -python manage.py advertise -python manage.py db upgrade -gunicorn -w 4 -b :80 --access-logfile - --error-logfile - --preload mailu:app diff --git a/optional/clamav/Dockerfile b/optional/clamav/Dockerfile index a27c0eb2..d00c00a3 100644 --- a/optional/clamav/Dockerfile +++ b/optional/clamav/Dockerfile @@ -3,9 +3,9 @@ FROM alpine:3.8 RUN apk add --no-cache clamav rsyslog wget clamav-libunrar COPY conf /etc/clamav -COPY start.sh /start.sh +COPY start.py /start.py EXPOSE 3310/tcp VOLUME ["/data"] -CMD ["/start.sh"] +CMD /start.py diff --git a/optional/clamav/start.py b/optional/clamav/start.py new file mode 100755 index 00000000..1d828ed0 --- /dev/null +++ b/optional/clamav/start.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 + +import os + +# Bootstrap the database if clamav is running for the first time +os.system("[ -f /data/main.cvd ] || freshclam") + +# Run the update daemon +os.system("freshclam -d -c 6") + +# Run clamav +os.system("clamd") \ No newline at end of file diff --git a/optional/clamav/start.sh b/optional/clamav/start.sh deleted file mode 100755 index 214230fd..00000000 --- a/optional/clamav/start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Bootstrap the database if clamav is running for the first time -[ -f /data/main.cvd ] || freshclam - -# Run the update daemon -freshclam -d -c 6 - -# Run clamav -clamd