Skip to content
Snippets Groups Projects
Commit e011c294 authored by jabertwo's avatar jabertwo
Browse files

Initial commit

parents
Branches main
No related tags found
No related merge requests found
FROM debian:bookworm
ENV DEBIAN_FRONTEND=noninteractive
# Install depandencies
RUN set -x && \
apt update && \
apt install -y --no-install-recommends \
ca-certificates \
uwsgi \
uwsgi-plugin-python3 \
python3 \
python3-flask \
python3-flask-sqlalchemy \
python3-flask-migrate \
python3-qrcode \
python3-fido2 \
python3-prometheus-client \
python3-jwt \
python3-cryptography \
python3-flask-babel \
python3-argon2 \
python3-itsdangerous \
python3-pymysql \
wget && \
rm -rf /var/lib/apt/lists/*
COPY uffd_2.3.1+git20231111T014902-3f41d2fb_all.deb uffd_2.3.1+git20231111T014902-3f41d2fb_all.deb
RUN set -x &&\
dpkg -i uffd_2.3.1+git20231111T014902-3f41d2fb_all.deb
COPY entrypoint.sh /entrypoint.sh
USER uffd
USER root
EXPOSE 3031/tcp
EXPOSE 9101/tcp
CMD bash /entrypoint.sh
#!/bin/bash
# Modded to Dockerfile
#echo "Copying static files ..."
#cp -r /usr/share/uffd/uffd/static /var/www/uffd
db_ready="false"
count=0
while [ $count -lt 32 ] && [ "$db_ready" != "true" ] ;do
if uffd-admin db current >> /dev/null 2>&1 ;then
db_ready="true"
else
echo "Waiting for db to become ready..."
((duration=2**$count))
sleep $duration
((count=$count+1))
fi
done
if [ "$db_ready" == "true" ] ;then
echo "Running datbase migrations ..."
uffd-admin db upgrade
if [ -n "$UFFD_INITIAL_ADMIN_PW" ] && [ "$(uffd-admin user list)" == "" ]; then
echo "Creating groups and roles for initial admin user ..."
if ! uffd-admin group show 'uffd_admin' >> /dev/null 2>&1 ;then
uffd-admin group create 'uffd_admin' --description 'Admin access to uffd'
fi
if ! uffd-admin group show 'uffd_access' >> /dev/null 2>&1 ;then
uffd-admin group create 'uffd_access' --description 'Access to Single-Sign-On and Selfservice'
fi
if ! uffd-admin role show 'uffd_admin' >> /dev/null 2>&1 ;then
uffd-admin role create 'uffd_admin' --add-group 'uffd_admin' --add-group 'uffd_access'
fi
if [ -z "$UFFD_INITIAL_ADMIN_USER" ] ;then
UFFD_INITIAL_ADMIN_USER='uffd_admin'
fi
if [ -z "$UFFD_INITIAL_ADMIN_MAIL" ] ;then
UFFD_INITIAL_ADMIN_MAIL='uffd_admin@localhost'
fi
echo "Creating initial admin user ..."
uffd-admin user create "$UFFD_INITIAL_ADMIN_USER" --password "$UFFD_INITIAL_ADMIN_PW" --mail "$UFFD_INITIAL_ADMIN_MAIL" --displayname 'uffd Admin' --add-role 'uffd_admin'
fi
else
echo "WARNING: Database is not ready yet, skipping migration and initialization"
fi
echo "Starting server ..."
runuser --preserve-environment -u uffd -- \
uwsgi --ini /etc/uwsgi/apps-enabled/uffd.ini --http-socket 0.0.0.0:3031 --master --stats 0.0.0.0:9191
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment