diff --git a/rosetta/build b/rosetta/build index cdee5b2f9d1a9fac338be410c72f4a1fdc1d7c0a..661699a2b965ce9f7f43eea957027e4809388018 100755 --- a/rosetta/build +++ b/rosetta/build @@ -31,7 +31,8 @@ fi if [[ "x$SERVICE" == "x" ]] ; then # Build all services - NOCACHE=$NOCACHE rosetta/build base + NOCACHE=$NOCACHE rosetta/build base_ubuntu18.04 + NOCACHE=$NOCACHE rosetta/build base_ubuntu22.04 NOCACHE=$NOCACHE rosetta/build slurmbase NOCACHE=$NOCACHE rosetta/build slurmcluster NOCACHE=$NOCACHE rosetta/build slurmclustermaster diff --git a/services/base/Dockerfile b/services/base_ubuntu18.04/Dockerfile similarity index 100% rename from services/base/Dockerfile rename to services/base_ubuntu18.04/Dockerfile diff --git a/services/base/entrypoint.sh b/services/base_ubuntu18.04/entrypoint.sh similarity index 100% rename from services/base/entrypoint.sh rename to services/base_ubuntu18.04/entrypoint.sh diff --git a/services/base/keys/authorized_keys b/services/base_ubuntu18.04/keys/authorized_keys similarity index 100% rename from services/base/keys/authorized_keys rename to services/base_ubuntu18.04/keys/authorized_keys diff --git a/services/base/keys/id_rsa b/services/base_ubuntu18.04/keys/id_rsa similarity index 100% rename from services/base/keys/id_rsa rename to services/base_ubuntu18.04/keys/id_rsa diff --git a/services/base/keys/id_rsa.pub b/services/base_ubuntu18.04/keys/id_rsa.pub similarity index 100% rename from services/base/keys/id_rsa.pub rename to services/base_ubuntu18.04/keys/id_rsa.pub diff --git a/services/base/prestartup.py b/services/base_ubuntu18.04/prestartup.py similarity index 100% rename from services/base/prestartup.py rename to services/base_ubuntu18.04/prestartup.py diff --git a/services/base/sudoers b/services/base_ubuntu18.04/sudoers similarity index 100% rename from services/base/sudoers rename to services/base_ubuntu18.04/sudoers diff --git a/services/base/supervisord.conf b/services/base_ubuntu18.04/supervisord.conf similarity index 100% rename from services/base/supervisord.conf rename to services/base_ubuntu18.04/supervisord.conf diff --git a/services/base/supervisord_sshd.conf b/services/base_ubuntu18.04/supervisord_sshd.conf similarity index 100% rename from services/base/supervisord_sshd.conf rename to services/base_ubuntu18.04/supervisord_sshd.conf diff --git a/services/base_ubuntu22.04/Dockerfile b/services/base_ubuntu22.04/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b0a3c7b6c1449b145f3c534367e5dc52087dce83 --- /dev/null +++ b/services/base_ubuntu22.04/Dockerfile @@ -0,0 +1,107 @@ +FROM ubuntu:22.04 +MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> + +#---------------------- +# Basics +#---------------------- + +# Set non-interactive +ENV DEBIAN_FRONTEND noninteractive + +# Update +RUN apt-get update + +# Utilities +RUN apt-get install -y nano telnet unzip wget supervisor openssh-server + +# Devel +RUN apt-get install -y build-essential python3-dev git-core + +# Java +RUN apt-get install -y openjdk-8-jre + +# IP utilities (mandatory for DNS!) +RUN apt-get install net-tools iproute2 iputils-ping -y + + +#------------------------ +# Rosetta user +#------------------------ + +# Add group. We chose GID 65527 to try avoiding conflicts. +RUN groupadd -g 65527 rosetta + +# Add user. We chose UID 65527 to try avoiding conflicts. +RUN useradd rosetta -d /rosetta -u 65527 -g 65527 -m -s /bin/bash + +# Add rosetta user to sudoers +RUN adduser rosetta sudo + +# Keys +RUN mkdir /rosetta/.ssh +COPY keys/authorized_keys /rosetta/.ssh/ +COPY keys/id_rsa /rosetta/.ssh/ +RUN chmod 0600 /rosetta/.ssh/id_rsa +COPY keys/id_rsa.pub /rosetta/.ssh/ +RUN chown -R rosetta:rosetta /rosetta/.ssh + +# Install suodo +RUN apt-get install sudo -y + +# No pass sudo (for everyone, actually) +COPY sudoers /etc/sudoers + +# bash_profile for loading correct env (/env.sh created by entrypoint.sh) +RUN echo "source /env.sh" > /rosetta/.bash_profile + + +#------------------------ +# Data, Logs and opt dirs +#------------------------ + +# Create dirs +RUN mkdir /data && mkdir /var/log/rosetta + +# Give right permissions +RUN chown -R rosetta:rosetta /data && chown -R rosetta:rosetta /var/log/rosetta + + +#---------------------- +# Supervisord conf +#---------------------- + +COPY supervisord.conf /etc/supervisor/ + + +#---------------------- +# SSH conf +#---------------------- + +RUN mkdir /var/run/sshd && chmod 0755 /var/run/sshd +COPY supervisord_sshd.conf /etc/supervisor/conf.d/ + + +#---------------------- +# Prestartup scripts +#---------------------- + +# Create dir for prestartup scripts and copy main script +RUN mkdir /prestartup +COPY prestartup.py / + + + +#---------------------- +# Entrypoint +#---------------------- + +# Copy entrypoint +COPY entrypoint.sh / + +# Give right permissions +RUN chmod 755 /entrypoint.sh + +# Set entrypoint +ENTRYPOINT ["/entrypoint.sh"] + + diff --git a/services/base_ubuntu22.04/entrypoint.sh b/services/base_ubuntu22.04/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..cb45b88103ea2492fb3b03a97dc1a82533c0bb5b --- /dev/null +++ b/services/base_ubuntu22.04/entrypoint.sh @@ -0,0 +1,130 @@ +#!/bin/bash + +# Exit on any error. More complex thing could be done in future +# (see https://stackoverflow.com/questions/4381618/exit-a-script-on-error) +set -e + +echo "" +echo "[INFO] Executing entrypoint..." + +#--------------------- +# Persistency +#--------------------- + +echo "[INFO] Handling safe persistency" +if [ "x$SAFE_PERSISTENCY" == "xTrue" ]; then + echo "[INFO] Safe persistency set" + if [ ! -f /safe_persistent/persistent.img ]; then + truncate -s 10G /safe_persistent/persistent.img + mkfs.ext4 -F /safe_persistent/persistent.img + fi + mkdir /persistent + mount -oloop /safe_persistent/persistent.img /persistent +fi + + +echo "[INFO] Handling persistency" + +# If persistent data: +if [ "x$PERSISTENT_DATA" == "xTrue" ]; then + echo "[INFO] Persistent data set" + if [ ! -f /persistent/data/.persistent_initialized ]; then + mv /data /persistent/data + ln -s /persistent/data /data + touch /data/.persistent_initialized + else + mkdir -p /trash + mv /data /trash + ln -s /persistent/data /data + fi +fi + +# If persistent log: +if [ "x$PERSISTENT_LOG" == "xTrue" ]; then + echo "[INFO] Persistent log set" + if [ ! -f /persistent/log/.persistent_initialized ]; then + mv /var/log /persistent/log + ln -s /persistent/log /var/log + touch /var/log/.persistent_initialized + else + mkdir -p /trash + mv /var/log /trash + ln -s /persistent/log /var/log + fi +fi + +# If persistent home: +if [ "x$PERSISTENT_HOME" == "xTrue" ]; then + echo "[INFO] Persistent home set" + if [ ! -f /persistent/home/.persistent_initialized ]; then + mv /home /persistent/home + ln -s /persistent/home /home + touch /home/.persistent_initialized + else + mkdir -p /trash + mv /home /trash + ln -s /persistent/home /home + fi +fi + + +# If persistent opt: +if [ "x$PERSISTENT_OPT" == "xTrue" ]; then + echo "[INFO] Persistent opt set" + if [ ! -f /persistent/opt/.persistent_initialized ]; then + mv /opt /persistent/opt + ln -s /persistent/opt /opt + touch /opt/.persistent_initialized + else + mkdir -p /trash + mv /opt /trash + ln -s /persistent/opt /opt + fi +fi + + +#--------------------- +# Prestartup scripts +#--------------------- + +if [ "x$SAFEMODE" == "xFalse" ]; then + echo "[INFO] Executing prestartup scripts (parents + current):" + python3 /prestartup.py +else + echo "[INFO] Not executing prestartup scripts as we are in safemode" +fi + + +#--------------------- +# Save env +#--------------------- +echo "[INFO] Dumping env" + +# Save env vars for later usage (e.g. ssh) + +env | \ +while read env_var; do + if [[ $env_var == HOME\=* ]]; then + : # Skip HOME var + elif [[ $env_var == PWD\=* ]]; then + : # Skip PWD var + else + echo "export $env_var" >> /env.sh + fi +done + +#--------------------- +# Entrypoint command +#--------------------- +# Start! + + +if [[ "x$@" == "x" ]] ; then + ENTRYPOINT_COMMAND="supervisord" +else + ENTRYPOINT_COMMAND=$@ +fi + +echo -n "[INFO] Executing Docker entrypoint command: " +echo $ENTRYPOINT_COMMAND +exec "$ENTRYPOINT_COMMAND" diff --git a/services/base_ubuntu22.04/keys/authorized_keys b/services/base_ubuntu22.04/keys/authorized_keys new file mode 100644 index 0000000000000000000000000000000000000000..e4e1df61a89a45e50620f4bc74ba5547481ecd2d --- /dev/null +++ b/services/base_ubuntu22.04/keys/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC2n4wiLiRmE1sla5+w0IW3wwPW/mqhhkm7IyCBS+rGTgnts7xsWcxobvamNdD6KSLNnjFZbBb7Yaf/BvWrwQgdqIFVU3gRWHYzoU6js+lKtBjd0e2DAVGivWCKEkSGLx7zhx7uH/Jt8kyZ4NaZq0p5+SFHBzePdR/1rURd8G8+G3OaCPKqP+JQT4RMUQHC5SNRJLcK1piYdmhDiYEyuQG4FlStKCWLCXeUY2EVirNMeQIfOgbUHJsVjH07zm1y8y7lTWDMWVZOnkG6Ap5kB+n4l1eWbslOKgDv29JTFOMU+bvGvYZh70lmLK7Hg4CMpXVgvw5VF9v97YiiigLwvC7wasBHaASwH7wUqakXYhdGFxJ23xVMSLnvJn4S++4L8t8bifRIVqhT6tZCPOU4fdOvJKCRjKrf7gcW/E33ovZFgoOCJ2vBLIh9N9ME0v7tG15JpRtgIBsCXwLcl3tVyCZJ/eyYMbc3QJGsbcPGb2CYRjDbevPCQlNavcMdlyrNIke7VimM5aW8OBJKVh5wCNRpd9XylrKo1cZHYxu/c5Lr6VUZjLpxDlSz+IuTn4VE7vmgHNPnXdlxRKjLHG/FZrZTSCWFEBcRoSa/hysLSFwwDjKd9nelOZRNBvJ+NY48vA8ixVnk4WAMlR/5qhjTRam66BVysHeRcbjJ2IGjwTJC5Q== docker@dev.ops diff --git a/services/base_ubuntu22.04/keys/id_rsa b/services/base_ubuntu22.04/keys/id_rsa new file mode 100644 index 0000000000000000000000000000000000000000..de5d6bf2a5ab7f74a4f706c7be5b0346b14ea73c --- /dev/null +++ b/services/base_ubuntu22.04/keys/id_rsa @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKQIBAAKCAgEAtp+MIi4kZhNbJWufsNCFt8MD1v5qoYZJuyMggUvqxk4J7bO8 +bFnMaG72pjXQ+ikizZ4xWWwW+2Gn/wb1q8EIHaiBVVN4EVh2M6FOo7PpSrQY3dHt +gwFRor1gihJEhi8e84ce7h/ybfJMmeDWmatKefkhRwc3j3Uf9a1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9LgBkICAOZeMQPe12q5BL2cI8S +Qu33VuVNC3lQaaage33zcL/mUFOMejyk2N4ZCBnnrVjfnqJ1aZpb10EYoR/iIQQu +oTpgT6zQkgIJonES55o8QTN4O1/mFHZ6LODGZ+XS+3Rz9MN4Rur90T7oDTLvXvqV +JOYA4QKCAQEAluueKFq4nUnGQ8U3/Pyc57qeyLZT8hAfSKdi8ttP31bXFtIs1Mu5 +fHoSqRtyQggnbCbccr4yoCzOT6nyqJvG/xj/UbquagY2RNeCRKSTHrfEZdsSR6LP +hXaWQrudm659nP+DZxFwEhIeYEqCoY8b2wZ24MROnV4roOd+qDu5VhwwHY5ItvPZ +jt66hjXtSQyzz+3LWI/yHGu2vKtWVtmcV+jeLvGXWBFZOsnd1+gVDT79Sq+qYsMe +XbH6BOi6Xu+Xq35dEyJTwuisLfmg5q9M7Uput7TXxr2G+PH6doFRQPETbMAvKFuk +3albnneNV2yzmF61ljC2XI9/UCgfzskoGQKCAQBcgsPCQREaEiMvfmWjoDeip/Cy +c0QzTJ6Oy5kVxfjHxRhEZyjKPBbXLGjewLoUfuBJvOJ7Iqadv5vP2AOUS0KMkmwt +w0rIUhk9WaLo+f4Fci1d14CPs59w2GYhSniGOT/qiPprUZVUr+J0fJ6q2i7kRUTR +gLmSxLEKbHUTKJVTJ0wviIHZYHA+WIQzK1j2NdVIjpLNRXaV4+g0vDBnmCovbBgy +VkyXcPF8q/aDjPcDb9cyCxt4PJQRrP7n959Y2sIjyVwAIEg5wzFuPp3LG+ITnLpG +TtrkLRzqxPKqAY0p4D/7exFyk4SeUHFWWifs7uYeflw3vxN+VmazFE4WdXh3 +-----END RSA PRIVATE KEY----- diff --git a/services/base_ubuntu22.04/keys/id_rsa.pub b/services/base_ubuntu22.04/keys/id_rsa.pub new file mode 100644 index 0000000000000000000000000000000000000000..9a0504b546f020c935181e7649fef5b6c32de8d0 --- /dev/null +++ b/services/base_ubuntu22.04/keys/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC2n4wiLiRmE1sla5+w0IW3wwPW/mqhhkm7IyCBS+rGTgnts7xsWcxobvamNdD6KSLNnjFZbBb7Yaf/BvWrwQgdqIFVU3gRWHYzoU6js+lKtBjd0e2DAVGivWCKEkSGLx7zhx7uH/Jt8kyZ4NaZq0p5+SFHBzePdR/1rURd8G8+G3OaCPKqP+JQT4RMUQHC5SNRJLcK1piYdmhDiYEyuQG4FlStKCWLCXeUY2EVirNMeQIfOgbUHJsVjH07zm1y8y7lTWDMWVZOnkG6Ap5kB+n4l1eWbslOKgDv29JTFOMU+bvGvYZh70lmLK7Hg4CMpXVgvw5VF9v97YiiigLwvC7wasBHaASwH7wUqakXYhdGFxJ23xVMSLnvJn4S++4L8t8bifRIVqhT6tZCPOU4fdOvJKCRjKrf7gcW/E33ovZFgoOCJ2vBLIh9N9ME0v7tG15JpRtgIBsCXwLcl3tVyCZJ/eyYMbc3QJGsbcPGb2CYRjDbevPCQlNavcMdlyrNIke7VimM5aW8OBJKVh5wCNRpd9XylrKo1cZHYxu/c5Lr6VUZjLpxDlSz+IuTn4VE7vmgHNPnXdlxRKjLHG/FZrZTSCWFEBcRoSa/hysLSFwwDjKd9nelOZRNBvJ+NY48vA8ixVnk4WAMlR/5qhjTRam66BVysHeRcbjJ2IGjwTJC5Q== rosetta@rosetta.platform diff --git a/services/base_ubuntu22.04/prestartup.py b/services/base_ubuntu22.04/prestartup.py new file mode 100644 index 0000000000000000000000000000000000000000..78edb3f99b584311463c0ec6a3761de15d8540e5 --- /dev/null +++ b/services/base_ubuntu22.04/prestartup.py @@ -0,0 +1,90 @@ + +import os +import sys +import datetime +import subprocess +from collections import namedtuple + +def shell(command, interactive=False): + '''Execute a command in the shell. By default prints everything. If the capture switch is set, + then it returns a namedtuple with stdout, stderr, and exit code.''' + + if interactive: + exit_code = subprocess.call(command, shell=True) + if exit_code == 0: + return True + else: + return False + + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + (stdout, stderr) = process.communicate() + exit_code = process.wait() + + # Convert to str (Python 3) + stdout = stdout.decode(encoding='UTF-8') + stderr = stderr.decode(encoding='UTF-8') + + # Output namedtuple + Output = namedtuple('Output', 'stdout stderr exit_code') + + # Return + return Output(stdout, stderr, exit_code) + + +prestartup_scripts_path='/prestartup' +def sorted_ls(path): + mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime + file_list = list(sorted(os.listdir(path), key=mtime)) + return file_list + +for item in sorted_ls(prestartup_scripts_path): + if item.endswith('.sh'): + + # Execute this startup script + print('[INFO] Executing prestartup script "{}"...'.format(item)) + script = prestartup_scripts_path+'/'+item + + # Use bash and not chmod + execute, see https://github.com/moby/moby/issues/9547 + out = shell('bash {}'.format(script)) + + # Set date + date_str = str(datetime.datetime.now()).split('.')[0] + + # Print and log stdout and stderr + for line in out.stdout.strip().split('\n'): + print(' out: {}'.format(line)) + + for line in out.stderr.strip().split('\n'): + print(' err: {}'.format(line)) + + # Handle error in the startup script + if out.exit_code: + print('[ERROR] Exit code "{}" for "{}"'.format(out.exit_code, item)) + + # Exit with error code 1 + sys.exit(1) + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/base_ubuntu22.04/sudoers b/services/base_ubuntu22.04/sudoers new file mode 100644 index 0000000000000000000000000000000000000000..47ab37c90fdec1df833409f825d2665fe7d1f899 --- /dev/null +++ b/services/base_ubuntu22.04/sudoers @@ -0,0 +1,30 @@ +# +# This file MUST be edited with the 'visudo' command as root. +# +# Please consider adding local content in /etc/sudoers.d/ instead of +# directly modifying this file. +# +# See the man page for details on how to write a sudoers file. +# +Defaults env_reset +Defaults mail_badpass +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +# Host alias specification + +# User alias specification + +# Cmnd alias specification + +# User privilege specification +root ALL=(ALL:ALL) ALL + +# Members of the admin group may gain root privileges +%admin ALL=(ALL) ALL + +# Allow members of group sudo to execute any command +%sudo ALL=(ALL:ALL) NOPASSWD:ALL + +# See sudoers(5) for more information on "#include" directives: + +#includedir /etc/sudoers.d diff --git a/services/base_ubuntu22.04/supervisord.conf b/services/base_ubuntu22.04/supervisord.conf new file mode 100644 index 0000000000000000000000000000000000000000..2f4678dd2cbe17a94e6489d14d47e0f0212383ce --- /dev/null +++ b/services/base_ubuntu22.04/supervisord.conf @@ -0,0 +1,34 @@ +; supervisor config file + +[unix_http_server] +file=/var/run/supervisor.sock ; (the path to the socket file) +chmod=0700 ; sockef file mode (default 0700) + +[supervisord] +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) +nodaemon=true ; Mandatory to run Supervisor in foreground and avoid Docker to exit! + +; The below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf + + + + + diff --git a/services/base_ubuntu22.04/supervisord_sshd.conf b/services/base_ubuntu22.04/supervisord_sshd.conf new file mode 100644 index 0000000000000000000000000000000000000000..b192539ea4cc0f90dc21d022f2304bedad757a54 --- /dev/null +++ b/services/base_ubuntu22.04/supervisord_sshd.conf @@ -0,0 +1,17 @@ +[program:sshd] + +; Process definition +process_name = sshd +command = /usr/sbin/sshd -D +autostart = true +autorestart = true +startsecs = 5 +stopwaitsecs = 10 + +; Log files +stdout_logfile = /var/log/supervisor/%(program_name)s_out.log +stdout_logfile_maxbytes = 10MB +stdout_logfile_backups = 5 +stderr_logfile = /var/log/supervisor/%(program_name)s_err.log +stderr_logfile_maxbytes = 10MB +stderr_logfile_backups = 5 diff --git a/services/postgres/Dockerfile b/services/postgres/Dockerfile index 35050d58f331e959c658e0ff7615939fa36d978f..0f6dfd3fea098ca1f5c6519da674a1ab6f8dfee5 100644 --- a/services/postgres/Dockerfile +++ b/services/postgres/Dockerfile @@ -1,4 +1,4 @@ -FROM rosetta/base +FROM rosetta/base_ubuntu18.04 MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> # Always start with an apt-get update when extending Reyns images, diff --git a/services/proxy/Dockerfile b/services/proxy/Dockerfile index aa3a5787576cf9057163102736b35bb8d9a43929..643f44b28cc1e98269bb03429c331d5e00938ecd 100644 --- a/services/proxy/Dockerfile +++ b/services/proxy/Dockerfile @@ -1,4 +1,4 @@ -FROM rosetta/base +FROM rosetta/base_ubuntu22.04 MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> # Always start with an apt-get update when extending Reyns images, diff --git a/services/slurmbase/Dockerfile b/services/slurmbase/Dockerfile index 7aafe0a06e030f20e72616b4b7c0e394c8f00c8d..fac75db47d317249fe3ee050aeb99ff0fd5801e5 100755 --- a/services/slurmbase/Dockerfile +++ b/services/slurmbase/Dockerfile @@ -1,4 +1,4 @@ -FROM rosetta/base +FROM rosetta/base_ubuntu18.04 MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> #---------------------- diff --git a/services/webapp/Dockerfile b/services/webapp/Dockerfile index a4f41b30b3a7d9c1bcc84614efc62db4a8085923..573b37955f75b4e31717ef7f6f163e19dcff6bbc 100644 --- a/services/webapp/Dockerfile +++ b/services/webapp/Dockerfile @@ -1,4 +1,4 @@ -FROM rosetta/base +FROM rosetta/base_ubuntu22.04 MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> # Always start with an apt-get update when extending base images, @@ -29,13 +29,16 @@ RUN apt-get install python3-dev -y # Install postgres driver required for psycopg2 RUN apt-get install libpq-dev -y +# Libmagic +RUN apt-get install libmagic1 -y + # Docker RUN apt-get install docker.io -y #------------------------------ # Viz #------------------------------ -RUN apt install python-pygraphviz graphviz-dev -y +RUN apt install python3-pygraphviz graphviz-dev -y RUN pip3 install django-extensions==3.1.5 pygraphviz==1.6 # Example usage: rosetta/shell webapp "cd /opt/code && python3 manage.py graph_models core_app --exclude-models LoginToken,Text -o ORM.png" @@ -51,8 +54,8 @@ RUN mkdir /opt/code COPY requirements.txt /tmp/ RUN cd /opt/code && pip3 install -r /tmp/requirements.txt -# Patch Django 2.2 non-ascii chars in /usr/local/lib/python3.6/dist-packages/django/views/templates/technical_500.html -RUN sed -i 's/[\x80-\xFF]/./g' /usr/local/lib/python3.6/dist-packages/django/views/templates/technical_500.html +# Patch Django 2.2 non-ascii chars in /usr/local/lib/python3.10/dist-packages/django/views/templates/technical_500.html +RUN sed -i 's/[\x80-\xFF]/./g' /usr/local/lib/python3.10/dist-packages/django/views/templates/technical_500.html # Install App code COPY code /opt/code @@ -81,4 +84,3 @@ COPY supervisord_dregistrytunnel.conf /etc/supervisor/conf.d/ COPY prestartup_webapp.sh /prestartup/ RUN touch -m /prestartup/prestartup_webapp.sh - diff --git a/services/webapp/requirements.txt b/services/webapp/requirements.txt index 5f8fcb2a5a6399b2eb5b2a334f537d89db11a0c1..439530f50586665cd377fa83d94a4fca8f36ecaf 100644 --- a/services/webapp/requirements.txt +++ b/services/webapp/requirements.txt @@ -1,11 +1,11 @@ Django==2.2.1 psycopg2==2.8 -pytz==2018.9 +pytz==2022.7.1 djangorestframework==3.9.3 django-rest-swagger==2.2.0 dateutils==0.6.6 sendgrid==5.3.0 mozilla-django-oidc==1.2.4 -uwsgi==2.0.19.1 +uwsgi==2.0.20 python-magic==0.4.15 jupyter-repo2docker==2022.2.0