From 11954d1a31286eedc9f7ba8915653f36e7d61b95 Mon Sep 17 00:00:00 2001 From: HeNine <> Date: Sun, 7 Nov 2021 15:53:00 +0100 Subject: [PATCH] Docker compose attempt 1 --- build.sh | 13 +++++++++++ buscribe-api/Dockerfile | 2 +- docker-compose.yml | 31 ++++++++++++++++++++++++ docker-less/Dockerfile | 5 ++++ nginx/Dockerfile | 4 ++++ nginx/nginx.conf | 52 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 build.sh create mode 100644 docker-compose.yml create mode 100644 docker-less/Dockerfile create mode 100644 nginx/Dockerfile create mode 100644 nginx/nginx.conf diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..2d2a2e0 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +VERSION=0.0.0 + +bash fetch_models.sh + +docker build -f buscribe/Dockerfile -t buscribe:$VERSION . +docker build -f buscribe-api/Dockerfile -t buscribe-api:$VERSION . + +docker build -f less/Dockerfile -t lessc +docker run --rm -v "$(pwd)"/buscribe-web:/buscribe-web lessc /buscribe-web/style.less > buscribe-web/style.css + +docker build -f nginx/Dockerfile -t buscribe-web:$VERSION . \ No newline at end of file diff --git a/buscribe-api/Dockerfile b/buscribe-api/Dockerfile index 35338b0..430158f 100644 --- a/buscribe-api/Dockerfile +++ b/buscribe-api/Dockerfile @@ -15,4 +15,4 @@ RUN apk add postgresql-dev postgresql-libs COPY buscribe-api /tmp/buscribe-api RUN pip install /tmp/buscribe-api && rm -r /tmp/buscribe-api -ENTRYPOINT ["python3", "-m", "buscribeapi"] +ENTRYPOINT ["python3", "-m", "buscribeapi", "--base-dir", "/mnt"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b09e4b9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: 3 +services: + buscribenginx: + image: buscribe-web:0.0.0 + ports: + - "8020:80" + volumes: + - /srv/wubloader/segments:/usr/share/nginx/html/segments + networks: + - wubloader_default + restart: "on-failure" + + buscribelrr: + image: buscribe:0.0.0 + command: [ "loadingreadyrun", + "--start-time='2021-11-05T00:00", + "--end-time='2021-11-30T00:00" . + "--database=postgresql://vst:flnMSYPRf@mula.lan:6543/buscribe_lrr", + "--model=/usr/share/buscribe/vosk-model-en-us-0.22/" ] + volumes: + - /srv/wubloader/segments:/mnt + + buscribeapilrr: + image: buscribe-api:0.0.0 + command: [ + "--database=postgresql://vst:flnMSYPRf@mula.lan:6543/buscribe_lrr" + "--bustime-start=2021-11-13T02:00:00"] + +networks: + wubloader_default: + external: true \ No newline at end of file diff --git a/docker-less/Dockerfile b/docker-less/Dockerfile new file mode 100644 index 0000000..1faf894 --- /dev/null +++ b/docker-less/Dockerfile @@ -0,0 +1,5 @@ +FROM node:17-alpine + +RUN npm install less -g + +ENTRYPOINT ["lessc"] \ No newline at end of file diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..24bfe15 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:latest + +COPY buscribe-web /usr/share/nginx/html/buscribe +COPY nginx/nginx.conf /etc/nginx/nginx.conf \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..7c3ba66 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,52 @@ + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + gzip on; + gzip gzip_comp_level 9; + + absolute_redirect off; + + server { + listen 80; + server_name localhost; + + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + + location / { proxy_pass http://nginx; } + location /buscribelrr { proxy_pass http://buscribeapilrr; } + + } + +}