[odrs-web/UBI8] Switch Dockerfile to UBI 8 Python 3.8 image
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web/UBI8] Switch Dockerfile to UBI 8 Python 3.8 image
- Date: Fri, 22 Apr 2022 11:10:39 +0000 (UTC)
commit 69dade279a310d5000974d8768903dd9e75cb94f
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Fri Apr 22 12:46:18 2022 +0200
Switch Dockerfile to UBI 8 Python 3.8 image
Dockerfile | 53 +++++-----------------------
app_data/requirements.txt | 1 +
app_data/wsgi-scripts/odrs-apache-setup.py | 25 -------------
app_data/{wsgi-scripts/odrs.wsgi => wsgi.py} | 0
entrypoint | 25 +++++++++++++
5 files changed, 34 insertions(+), 70 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index d7a70f6..c01fe33 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,51 +1,14 @@
-FROM centos/httpd-24-centos7
+FROM registry.access.redhat.com/ubi8/python-38
-USER root
+USER 0
+ADD app_data /tmp/src
+RUN /usr/bin/fix-permissions /tmp/src
-RUN yum install -y gcc make \
- brotli \
- mariadb \
- mariadb-devel \
- python36-devel \
- python36-PyMySQL \
- rh-python36-mod_wsgi \
- uwsgi-plugin-python36
+USER 1001
+RUN /usr/libexec/s2i/assemble
ENV ODRS_HOME=/opt/app-root/src \
LANG=C
-WORKDIR ${ODRS_HOME}
-
-COPY app_data ${ODRS_HOME}
-
-RUN pip3 install --prefix=/usr -r ${ODRS_HOME}/requirements.txt
-
-RUN LANG=en_US.utf8 \
- FLASK_APP=odrs/__init__.py \
- SQLALCHEMY_TRACK_MODIFICATIONS=False \
- flask db upgrade
-
-RUN python3 /opt/app-root/src/cron.py fsck
-
-RUN curl https://dl.flathub.org/repo/appstream/x86_64/appstream.xml.gz -o /tmp/appstream.xml.gz
-
-RUN python3 /opt/app-root/src/cron.py appstream-import /tmp/appstream.xml.gz
-
-RUN curl https://raw.githubusercontent.com/hughsie/badwords/master/badwords.csv -o /tmp/badwords.csv
-
-RUN LANG=en_US.utf8 python3 /opt/app-root/src/cron.py taboo-import /tmp/badwords.csv
-
-RUN python3 /opt/app-root/src/cron.py ratings /opt/app-root/src/odrs/static/ratings.json
-RUN cp /opt/app-root/src/odrs/static/ratings.json /opt/app-root/src/odrs/static/ratings.json.bak
-RUN gzip /opt/app-root/src/odrs/static/ratings.json
-RUN mv /opt/app-root/src/odrs/static/ratings.json.bak /opt/app-root/src/odrs/static/ratings.json
-RUN brotli -k /opt/app-root/src/odrs/static/ratings.json
-
-RUN chown -R 1000310000:0 ${ODRS_HOME} && \
- chmod -R 664 ${ODRS_HOME} && \
- find ${ODRS_HOME} -type d -exec chmod 775 {} +
-
-EXPOSE 8443
-
-USER 1001
-ENTRYPOINT ["/usr/bin/run-httpd"]
+ADD entrypoint /entrypoint
+CMD /entrypoint
diff --git a/app_data/requirements.txt b/app_data/requirements.txt
index 1b4f8fb..951ed50 100644
--- a/app_data/requirements.txt
+++ b/app_data/requirements.txt
@@ -8,6 +8,7 @@ Flask-Migrate==3.1.0
Flask-SQLAlchemy==2.5.1
Flask-WTF==1.0.0
greenlet==1.1.2
+gunicorn==20.1.0
iniconfig==1.1.1
isort==5.10.1
itsdangerous==2.0.1
diff --git a/app_data/wsgi-scripts/odrs.wsgi b/app_data/wsgi.py
similarity index 100%
rename from app_data/wsgi-scripts/odrs.wsgi
rename to app_data/wsgi.py
diff --git a/entrypoint b/entrypoint
new file mode 100755
index 0000000..1381ed4
--- /dev/null
+++ b/entrypoint
@@ -0,0 +1,25 @@
+#!/bin/bash
+set -euo pipefail
+
+export FLASK_APP=odrs/__init__.py
+export SQLALCHEMY_TRACK_MODIFICATIONS=False
+flask db upgrade
+
+while true; do python3 /opt/app-root/src/cron.py fsck ; sleep 43200 ; done &
+
+curl https://dl.flathub.org/repo/appstream/x86_64/appstream.xml.gz -o /tmp/appstream.xml.gz
+python /opt/app-root/src/cron.py appstream-import /tmp/appstream.xml.gz
+
+curl https://raw.githubusercontent.com/hughsie/badwords/master/badwords.csv -o /tmp/badwords.csv
+python /opt/app-root/src/cron.py taboo-import /tmp/badwords.csv
+
+while true; do
+ python /opt/app-root/src/cron.py ratings /opt/app-root/src/odrs/static/ratings.json
+ cp /opt/app-root/src/odrs/static/ratings.json /opt/app-root/src/odrs/static/ratings.json.bak
+ gzip /opt/app-root/src/odrs/static/ratings.json
+ mv /opt/app-root/src/odrs/static/ratings.json.bak /opt/app-root/src/odrs/static/ratings.json
+ brotli -k /opt/app-root/src/odrs/static/ratings.json
+ sleep 43200
+done &
+
+exec /usr/libexec/s2i/run
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]