diff --git a/.dockerignore b/.dockerignore
index bfb164d..8b2d2d7 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1 +1,23 @@
+.DS_Store
+__pycache__
+*.pyc
+.git
+.gitignore
+config.py
ksi-py3-venv
+.ipynb_checkpoints
+
+.idea
+
+build/*
+*_build/*.html
+*_build/archived/*
+
+.env
+*.secret
+
+!**/.gitkeep
+!**/index.html
+
+docker-compose.yaml
+docker/Dockerfile
diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml
new file mode 100644
index 0000000..ce16ba4
--- /dev/null
+++ b/.github/workflows/build-docker.yml
@@ -0,0 +1,33 @@
+name: Docker Compose Build and Push
+
+on:
+ push:
+ branches:
+ - main
+ - master
+
+jobs:
+ build_and_push:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out the repository, including submodules
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ path: web
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Log in to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build and push Docker images
+ working-directory: ./web
+ run: |
+ docker compose build
+ docker compose push
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 08a9bdc..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,19 +0,0 @@
-FROM ubuntu:18.04
-
-RUN apt update
-RUN apt install -y python3 python3-dev python3-pip python3-venv libmysqlclient-dev gcc # make
-
-# RUN pip3 install jupyter wheel
-
-EXPOSE 8080
-WORKDIR /myapp
-
-COPY requirements_3.6.lock.txt ./
-
-RUN pip3 install -r requirements_3.6.lock.txt
-
-COPY ./ /myapp
-
-# run ember server on container start
-ENTRYPOINT ["jupyter"]
-CMD ["notebook", "--no-browser", "--ip=0.0.0.0", "--port=8080", "--allow-root"]
diff --git a/Makefile b/Makefile
index b53d405..80ab387 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,11 @@
-KSI_TARGETS=$(patsubst notebooks/%.ipynb, ksi_build/%.html, $(wildcard notebooks/*.ipynb))
-NASKOC_TARGETS=$(patsubst notebooks/%.ipynb, naskoc_build/%.html, $(wildcard notebooks/*.ipynb))
-DOCKER_TARGETS=$(patsubst notebooks/%.ipynb, docker_build/%.html, $(wildcard notebooks/*.ipynb))
+TARGETS=$(patsubst notebooks/%.ipynb, build/%.html, $(wildcard notebooks/*.ipynb))
-ksi: $(KSI_TARGETS)
-naskoc: $(NASKOC_TARGETS)
-docker: $(DOCKER_TARGETS)
-all: $(KSI_TARGETS) $(NASKOC_TARGETS)
+all: $(TARGETS)
-include .env
-
-# Note: Race condition on file db_uri.secret
-
-ksi_build/%.html: notebooks/%.ipynb
- echo $(DB_URI_KSI) > db_uri.secret
- ksi-py3-venv/bin/python3 export_monitoring_notebook $< $@
- rm db_uri.secret || true
-
-naskoc_build/%.html: notebooks/%.ipynb
- echo $(DB_URI_NASKOC) > db_uri.secret
- ksi-py3-venv/bin/python3 export_monitoring_notebook $< $@
- rm db_uri.secret || true
-
-docker_build/%.html: notebooks/%.ipynb
+build/%.html: notebooks/%.ipynb
python3 export_monitoring_notebook $< $@
clean:
- rm -rf $(KSI_TARGETS)
- rm -rf $(NASKOC_TARGETS)
rm -rf $(DOCKER_TARGETS)
.PHONY: all clean
diff --git a/ksi_build/custom.css b/build/custom.css
similarity index 100%
rename from ksi_build/custom.css
rename to build/custom.css
diff --git a/ksi_build/index.html b/build/index.html
similarity index 100%
rename from ksi_build/index.html
rename to build/index.html
diff --git a/ksi_build/style.css b/build/style.css
similarity index 100%
rename from ksi_build/style.css
rename to build/style.css
diff --git a/config.py.sample b/config.py.sample
new file mode 100644
index 0000000..f87f7b2
--- /dev/null
+++ b/config.py.sample
@@ -0,0 +1 @@
+SQL_ALCHEMY_URI = 'mariadb+pymysql://user:password@server/db?charset=utf8mb4'
diff --git a/docker-compose.yml b/docker-compose.yml
index ed96e64..3955290 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,17 +1,16 @@
version: '2'
services:
- dashboardbuild:
- build: .
+ ksi-dashboard:
+ build:
+ context: .
+ dockerfile: docker/Dockerfile
+ container_name: ksi-dashboard
+ image: fi0ksi/ksi-dashboard
volumes:
- # - ./:/myapp
- - ./docker_build:/myapp/docker_build
- ports:
- - "8080:8080"
- # entrypoint: /myapp/build_in_docker.sh
-
- # If you want manual bash, do the following.
- # 1. Uncomment the following line:
- # entrypoint: tail -f /dev/null # Uncomment this if you want to start bash manually after the
- # 2. Do `docker-compose up -d --build`
- # 3. After it finishes, run `docker exec -it web-frontend_ember_1 /bin/bash`
+ - ./build:/myapp/build
+ - ./config.py:/myapp/config.py:ro
+ # ports:
+ # - "127.0.0.1:8080:8080"
+ entrypoint: /bin/bash
+ command: /myapp/docker/build_in_docker.sh
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..04b10e3
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,16 @@
+FROM python:3.9
+
+RUN pip3 install jupyter==1.0.0 wheel setuptools notebook==6.4.11
+
+EXPOSE 8080
+WORKDIR /myapp
+
+COPY requirements.txt ./
+
+RUN pip3 install -r requirements.txt
+
+COPY ./ /myapp
+
+# run ember server on container start
+ENTRYPOINT ["jupyter"]
+CMD ["notebook", "--no-browser", "--ip=0.0.0.0", "--port=8080", "--allow-root"]
diff --git a/build_in_docker.sh b/docker/build_in_docker.sh
similarity index 52%
rename from build_in_docker.sh
rename to docker/build_in_docker.sh
index 67b5916..9b11942 100644
--- a/build_in_docker.sh
+++ b/docker/build_in_docker.sh
@@ -4,5 +4,4 @@ set -e
cd /myapp
-make clean
-make docker_all
+make all
diff --git a/kleobis-deploy.sh b/kleobis-deploy.sh
deleted file mode 100755
index fe893e2..0000000
--- a/kleobis-deploy.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-set -xuo pipefail
-cd "$(dirname "$(realpath "$0")")"
-
-git fetch origin
-git reset --hard origin/master
-
-make clean
-# Run as www-data to prevent vulnerabilities possible spread
-sudo -Hu www-data make all -j 1 && # don't use higher -j than 1, otherwise race condition
-curl --silent https://status.ahlava.cz/api/push/u44pwYohQ2 > /dev/null
diff --git a/ksi_build/.gitkeep b/ksi_build/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/ksi_build/.htaccess b/ksi_build/.htaccess
deleted file mode 100644
index ee25a8e..0000000
--- a/ksi_build/.htaccess
+++ /dev/null
@@ -1,11 +0,0 @@
-