diff --git a/testserver/docker_uffd/templates/Dockerfile b/testserver/docker_uffd/templates/Dockerfile index 36bcfcdf9da7cbc35a60ac5829af5ff540e3dad1..00c5b92359104116e89dc4a546562188f9736c17 100644 --- a/testserver/docker_uffd/templates/Dockerfile +++ b/testserver/docker_uffd/templates/Dockerfile @@ -1,70 +1,39 @@ -FROM debian:bookworm AS build-stage +FROM debian:bullseye ENV DEBIAN_FRONTEND=noninteractive -ENV PYBUILD_INSTALL_ARGS="--install-lib=/usr/share/uffd/ --install-scripts=/usr/share/uffd/" -ENV PACKAGE_VERSION=v2.3.1.r21 +# Install depandencies RUN set -x && \ apt update && \ apt install -y --no-install-recommends \ - lsb-release \ - curl \ - ca-certificates \ - locales-all \ - git \ - python3 \ - python3-venv \ - python3-coverage \ - python3-ldap3 \ - python3-flask \ - python3-flask-sqlalchemy \ - python3-flask-migrate \ - python3-pip \ - python3-qrcode \ - python3-fido2 \ - python3-oauthlib \ - python3-flask-babel \ - python3-argon2 \ - python3-pytest \ - python3-all \ - python3-pip \ - git-buildpackage \ - debhelper \ - build-essential \ - dh-python \ - python3-mysqldb \ - python3-requests-oauthlib \ - python3-git \ - python3-prometheus-client \ - libffi-dev \ - python3-build \ - twine && \ - apt -qq clean - -RUN git clone https://git.cccv.de/uffd/uffd.git -WORKDIR /uffd -RUN git checkout 3f41d2fb7f686c12a1f09577e5b96da89ff46e07 - -RUN set -x && \ - ./debian/create_changelog.py uffd > debian/changelog && \ - dpkg-buildpackage -us -uc && \ - dpkg-deb -I /*.deb && \ - dpkg-deb -c /*.deb && \ - mv /*.deb /uffd/uffd.deb - -FROM debian:bookworm as app-stage - -COPY --from=build-stage /uffd/uffd.deb /uffd.deb - + ca-certificates \ + curl \ + gnupg2 \ + python3 \ + python3-argon2 \ + python3-cryptography \ + python3-fido2 \ + python3-flask \ + python3-flask-babel \ + python3-flask-sqlalchemy \ + python3-flask-migrate \ + python3-itsdangerous \ + python3-jwt \ + python3-qrcode \ + python3-prometheus-client \ + python3-pymysql \ + python3-oauthlib \ + python3-uaparser \ + wget && \ + rm -rf /var/lib/apt/lists/* + +# Install uffd from CCCV Repo RUN set -x && \ + echo "deb https://packages.cccv.de/uffd bullseye main" > /etc/apt/sources.list.d/cccv-archive-bullseye.list && \ + curl -sS https://packages.cccv.de/docs/cccv-archive-key.gpg | gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/cccv-archive-key.gpg && \ apt update && \ - apt install -y --no-install-recommends /uffd.deb python3-psycopg2 python3-pymysql && \ - rm -rf /var/lib/apt/lists/* && \ - rm /uffd.deb && \ - cat /etc/uffd/uffd.cfg | grep -v "SECRET_KEY=" > /etc/uffd/uffd.cfg.tmp && \ - mv /etc/uffd/uffd.cfg.tmp /etc/uffd/uffd.cfg && \ - mkdir --parents /var/www/uffd && \ - chown root:uffd /var/www/uffd + apt install -y --no-install-recommends uffd=2.3.1 && \ + rm -rf /var/lib/apt/lists/* COPY entrypoint.sh /entrypoint.sh diff --git a/testserver/docker_uffd/templates/Dockerfile-custom-build b/testserver/docker_uffd/templates/Dockerfile-custom-build new file mode 100644 index 0000000000000000000000000000000000000000..36bcfcdf9da7cbc35a60ac5829af5ff540e3dad1 --- /dev/null +++ b/testserver/docker_uffd/templates/Dockerfile-custom-build @@ -0,0 +1,77 @@ +FROM debian:bookworm AS build-stage + +ENV DEBIAN_FRONTEND=noninteractive +ENV PYBUILD_INSTALL_ARGS="--install-lib=/usr/share/uffd/ --install-scripts=/usr/share/uffd/" +ENV PACKAGE_VERSION=v2.3.1.r21 + +RUN set -x && \ + apt update && \ + apt install -y --no-install-recommends \ + lsb-release \ + curl \ + ca-certificates \ + locales-all \ + git \ + python3 \ + python3-venv \ + python3-coverage \ + python3-ldap3 \ + python3-flask \ + python3-flask-sqlalchemy \ + python3-flask-migrate \ + python3-pip \ + python3-qrcode \ + python3-fido2 \ + python3-oauthlib \ + python3-flask-babel \ + python3-argon2 \ + python3-pytest \ + python3-all \ + python3-pip \ + git-buildpackage \ + debhelper \ + build-essential \ + dh-python \ + python3-mysqldb \ + python3-requests-oauthlib \ + python3-git \ + python3-prometheus-client \ + libffi-dev \ + python3-build \ + twine && \ + apt -qq clean + +RUN git clone https://git.cccv.de/uffd/uffd.git +WORKDIR /uffd +RUN git checkout 3f41d2fb7f686c12a1f09577e5b96da89ff46e07 + +RUN set -x && \ + ./debian/create_changelog.py uffd > debian/changelog && \ + dpkg-buildpackage -us -uc && \ + dpkg-deb -I /*.deb && \ + dpkg-deb -c /*.deb && \ + mv /*.deb /uffd/uffd.deb + +FROM debian:bookworm as app-stage + +COPY --from=build-stage /uffd/uffd.deb /uffd.deb + +RUN set -x && \ + apt update && \ + apt install -y --no-install-recommends /uffd.deb python3-psycopg2 python3-pymysql && \ + rm -rf /var/lib/apt/lists/* && \ + rm /uffd.deb && \ + cat /etc/uffd/uffd.cfg | grep -v "SECRET_KEY=" > /etc/uffd/uffd.cfg.tmp && \ + mv /etc/uffd/uffd.cfg.tmp /etc/uffd/uffd.cfg && \ + mkdir --parents /var/www/uffd && \ + chown root:uffd /var/www/uffd + +COPY entrypoint.sh /entrypoint.sh + +USER uffd +USER root + +EXPOSE 3031/tcp +EXPOSE 9191/tcp + +CMD bash /entrypoint.sh diff --git a/testserver/docker_uffd/templates/entrypoint.sh b/testserver/docker_uffd/templates/entrypoint.sh index 81e92a9a3dfe9dc88c6bf999678b0a48bb37b26f..247cc712cc414088c99778e8ea678999bf0354b9 100644 --- a/testserver/docker_uffd/templates/entrypoint.sh +++ b/testserver/docker_uffd/templates/entrypoint.sh @@ -7,7 +7,7 @@ db_ready="false" count=0 while [ $count -lt 32 ] && [ "$db_ready" != "true" ] ;do - if uffd-admin db current >> /dev/null 2>&1 ;then + if [ -z "$(uffd-admin db current 2>&1 | grep -o "Error")" ] ;then db_ready="true" else echo "Waiting for db to become ready..."