[odrs-web] Serve static file at /1.0/reviews/api/ratings
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web] Serve static file at /1.0/reviews/api/ratings
- Date: Thu, 28 Apr 2022 13:36:06 +0000 (UTC)
commit fdb86e3fe32190f990026bf5521d6ac9405ac2d7
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Thu Apr 28 15:35:30 2022 +0200
Serve static file at /1.0/reviews/api/ratings
Dockerfile | 14 +++++---------
docker-compose.yml | 5 +++++
entrypoint | 10 +++++++---
nginx.conf | 4 ++++
4 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index fe2ed32..a50b88a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,15 +1,11 @@
-FROM registry.access.redhat.com/ubi8/python-38
+FROM registry.access.redhat.com/ubi8/python-39
-USER 0
-ADD . /tmp/src/
-RUN /usr/bin/fix-permissions /tmp/src
-
-USER 1001
-RUN /usr/libexec/s2i/assemble
+ADD requirements.txt .
+RUN pip install -r requirements.txt
+ADD . .
ENV ODRS_HOME=/opt/app-root/src \
LANG=C \
APP_MODULE=odrs:app
-ADD entrypoint /entrypoint
-CMD /entrypoint
+CMD /opt/app-root/src/entrypoint
diff --git a/docker-compose.yml b/docker-compose.yml
index cb3fb58..da45d50 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,5 +1,8 @@
version: "3"
+volumes:
+ ratings:
+
services:
odrs:
image: odrs
@@ -17,6 +20,7 @@ services:
- db
volumes:
- .:/opt/app-root/src:z
+ - ratings:/tmp/ratings
db:
image: docker.io/library/mariadb:10.2
@@ -32,5 +36,6 @@ services:
image: docker.io/nginxinc/nginx-unprivileged:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
+ - ratings:/tmp/ratings
ports:
- "8000:8000"
diff --git a/entrypoint b/entrypoint
index 06188d8..1be65f5 100755
--- a/entrypoint
+++ b/entrypoint
@@ -14,9 +14,13 @@ curl https://raw.githubusercontent.com/hughsie/badwords/master/badwords.csv -o /
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
- gzip -k -f /opt/app-root/src/odrs/static/ratings.json
- brotli -k /opt/app-root/src/odrs/static/ratings.json
+ python /opt/app-root/src/cron.py ratings /tmp/ratings/ratings.json
+
+ cp /tmp/ratings/ratings.json /tmp/ratings/ratings.json.bak
+ gzip /tmp/ratings/ratings.json
+ mv /tmp/ratings/ratings.json.bak /tmp/ratings/ratings.json
+
+ brotli -k /tmp/ratings/ratings.json
sleep 43200
done &
diff --git a/nginx.conf b/nginx.conf
index 2d49007..f0d2c06 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -55,6 +55,10 @@ http {
proxy_pass http://odrs:8080/;
}
+ location /1.0/reviews/api/ratings {
+ alias /tmp/ratings/ratings.json;
+ }
+
location ~* \.(?:ico|css|svg|js|json|jpe?g|png)$ {
expires 30d;
add_header Pragma public;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]