diff --git a/core/admin/Dockerfile b/core/admin/Dockerfile index a9cc61c2..4d6aa75a 100644 --- a/core/admin/Dockerfile +++ b/core/admin/Dockerfile @@ -37,10 +37,11 @@ WORKDIR /app COPY requirements-prod.txt requirements.txt RUN set -eu \ && apk add --no-cache libressl curl postgresql-libs mariadb-connector-c \ - && apk add --no-cache --virtual build-dep libressl-dev libffi-dev python3-dev build-base postgresql-dev mariadb-connector-c-dev cargo \ + && pip install --no-cache-dir --extra-index-url=https://www.piwheels.org/simple -r requirements.txt --only-binary=:all: --no-binary=Flask-bootstrap,PyYAML,SQLAlchemy \ + || ( apk add --no-cache --virtual build-dep libressl-dev libffi-dev python3-dev build-base postgresql-dev mariadb-connector-c-dev cargo \ && pip install --upgrade pip \ && pip install -r requirements.txt \ - && apk del --no-cache build-dep + && apk del --no-cache build-dep ) COPY --from=assets static ./mailu/static COPY mailu ./mailu diff --git a/core/admin/requirements-prod.txt b/core/admin/requirements-prod.txt index f14e484c..297c6902 100644 --- a/core/admin/requirements-prod.txt +++ b/core/admin/requirements-prod.txt @@ -5,7 +5,7 @@ bcrypt==3.2.0 blinker==1.4 CacheControl==0.12.9 certifi==2021.10.8 -cffi==1.15.0 +# cffi==1.15.0 chardet==4.0.0 click==8.0.3 colorama==0.4.4 @@ -43,13 +43,15 @@ MarkupSafe==2.0.1 marshmallow==3.14.0 marshmallow-sqlalchemy==0.26.1 msgpack==1.0.2 -mysqlclient==2.0.3 +# mysqlclient==2.0.3 +mysql-connector-python==8.0.25 ordered-set==4.0.2 # packaging==20.9 passlib==1.7.4 # pep517==0.10.0 progress==1.6 -psycopg2==2.9.1 +#psycopg2==2.9.1 +psycopg2-binary==2.9.3 pycparser==2.20 Pygments==2.10.0 pyOpenSSL==21.0.0 diff --git a/core/admin/requirements.txt b/core/admin/requirements.txt index 61fbd92c..5bf57874 100644 --- a/core/admin/requirements.txt +++ b/core/admin/requirements.txt @@ -19,7 +19,7 @@ PyOpenSSL Pygments dnspython tenacity -mysqlclient +mysql-connector-python idna srslib marshmallow diff --git a/core/postfix/Dockerfile b/core/postfix/Dockerfile index f9285ebf..b048a15e 100644 --- a/core/postfix/Dockerfile +++ b/core/postfix/Dockerfile @@ -22,9 +22,9 @@ RUN apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev \ # Image specific layers under this line # Building pycares from source requires py3-wheel and libffi-dev packages -RUN apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev py3-wheel libffi-dev \ - && pip3 install --no-binary :all: postfix-mta-sts-resolver==1.0.1 \ - && apk del .build-deps +RUN pip install --no-cache-dir --extra-index-url=https://www.piwheels.org/simple --only-binary=:all: postfix-mta-sts-resolver==1.0.1 || (apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev py3-wheel libffi-dev \ + && pip3 install postfix-mta-sts-resolver==1.0.1 \ + && apk del .build-deps ) RUN apk add --no-cache postfix postfix-pcre cyrus-sasl-login rsyslog logrotate @@ -37,4 +37,4 @@ VOLUME ["/queue"] CMD /start.py HEALTHCHECK --start-period=350s CMD echo QUIT|nc localhost 25|grep "220 .* ESMTP Postfix" -RUN echo $VERSION >> /version \ No newline at end of file +RUN echo $VERSION >> /version diff --git a/tests/compose/test.py b/tests/compose/test.py index 690855d4..02575535 100755 --- a/tests/compose/test.py +++ b/tests/compose/test.py @@ -1,9 +1,12 @@ import sys import os import time +import datetime +from xmlrpc.client import DateTime import docker from colorama import Fore, Style import subprocess +import calendar # Declare variables for service name and sleep time test_name=sys.argv[1] @@ -22,12 +25,7 @@ def stop(exit_code): print(subprocess.check_output("docker-compose -f " + compose_file + " down", shell=True).decode()) sys.exit(exit_code) -# Sleep for a defined amount of time -def sleep(): - print(Fore.LIGHTMAGENTA_EX + "Sleeping for " + str(timeout) + "m" + Style.RESET_ALL) - time.sleep(timeout*60) - -def health_checks(): +def health_checks(deadline): exit_code = 0 #Iterating trough all containers dictionary for container in client.containers(all=True): @@ -58,7 +56,9 @@ def health_checks(): #Adding the generated dictionary to a list containers.append(containers_dict) - if exit_code != 0: + if exit_code == 0: + return True + elif exit_code != 0 and deadline < datetime.datetime.now().timestamp(): stop(exit_code) def print_logs(): @@ -86,14 +86,20 @@ def hooks(): # Start up containers sys.stdout.flush() +deadline=datetime.datetime.now()+datetime.timedelta(minutes=timeout) +deadline=calendar.timegm(deadline.timetuple()) print(subprocess.check_output("docker-compose -f " + compose_file + " up -d", shell=True).decode()) print() -sleep() +print(Fore.LIGHTMAGENTA_EX + "Sleeping for 10s" + Style.RESET_ALL) +time.sleep(10) print() sys.stdout.flush() print(subprocess.check_output("docker ps -a", shell=True).decode()) print() -health_checks() +while not health_checks(deadline): + print(Fore.LIGHTMAGENTA_EX + "Sleeping for 10s" + Style.RESET_ALL) + sys.stdout.flush() + time.sleep(10) print() hooks() print()