From 33081e261fbba18de5c69d190c0d3064b2b5539e Mon Sep 17 00:00:00 2001
From: Artem Baranovskyi <artem.baranovsky1980@gmail.com>
Date: Thu, 20 Jun 2024 10:36:25 +0300
Subject: [PATCH] Dummy API is bind to http://127.0.0.1:5000/api/data
 ----------------------------------------------------------- TODO: Create an
 API to use script run_LR_SBERT.py on http://127.0.0.1:5000/api/data or like
 that. Configure relative paths at ASYST script (run_LR_SBERT.py).

---
 Dockerfile       |  8 +++++++-
 supervisord.conf | 13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 supervisord.conf

diff --git a/Dockerfile b/Dockerfile
index 1c797eb..ab9cf7d 100755
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,7 +17,7 @@ ENV MOODLE_BASE_DIR_DATA ${MOODLE_BASE_DIR_DATA}
 
 # Installing necessary packages
 RUN apt-get update && apt-get upgrade -y && \
-    apt-get install -y apache2 php libapache2-mod-php php-mysqli php-mysql php-xml php-pdo php-pdo-mysql mariadb-client mariadb-server wget unzip p7zip-full python3 python3-pip iputils-ping php-mbstring graphviz aspell ghostscript clamav php8.2-pspell php8.2-curl php8.2-gd php8.2-intl php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-ldap php8.2-zip php8.2-soap php8.2-mbstring openssl git && \
+    apt-get install -y apache2 php libapache2-mod-php php-mysqli php-mysql php-xml php-pdo php-pdo-mysql mariadb-client mariadb-server wget unzip p7zip-full python3 python3-pip iputils-ping php-mbstring graphviz aspell ghostscript clamav php8.2-pspell php8.2-curl php8.2-gd php8.2-intl php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-ldap php8.2-zip php8.2-soap php8.2-mbstring openssl git nano supervisor && \
     apt-get clean && rm -rf /var/lib/apt/lists/*
 
 # Setting necessary php params
@@ -153,3 +153,9 @@ EXPOSE 80 443 5000
 # Run the Flask app (modify entrypoint or use a custom script if needed)
 #CMD ["bash", "-c", "service apache2 start && source /opt/myenv/bin/activate && python3 /var/www/html/moodle/install_moodle.sh /var/www/html/moodle/api.py "]
 #CMD ["bash", "-c", "service apache2 start && source /opt/myenv/bin/activate && python3 /var/www/html/moodle/api.py && /var/www/html/moodle/install_moodle.sh"]
+
+# Setting up supervisord
+COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
+
+# Running supervisord
+CMD ["/usr/bin/supervisord"]
\ No newline at end of file
diff --git a/supervisord.conf b/supervisord.conf
new file mode 100644
index 0000000..8cc191d
--- /dev/null
+++ b/supervisord.conf
@@ -0,0 +1,13 @@
+[supervisord]
+nodaemon=true
+
+[program:apache2]
+command=/usr/sbin/apache2ctl -D FOREGROUND
+autostart=true
+autorestart=true
+
+[program:flask]
+command=/opt/myenv/bin/python /var/www/html/moodle/api.py
+directory=/var/www/html/moodle
+autostart=true
+autorestart=true
\ No newline at end of file
-- 
GitLab