Skip to content

Commit

Permalink
feat(docker): build
Browse files Browse the repository at this point in the history
  • Loading branch information
esoadamo committed Nov 13, 2024
1 parent 5fb397b commit 429d43c
Show file tree
Hide file tree
Showing 25 changed files with 97 additions and 313 deletions.
22 changes: 22 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

27 changes: 3 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions config.py.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SQL_ALCHEMY_URI = 'mariadb+pymysql://user:password@server/db?charset=utf8mb4'
25 changes: 12 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
3 changes: 1 addition & 2 deletions build_in_docker.sh → docker/build_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ set -e

cd /myapp

make clean
make docker_all
make all
11 changes: 0 additions & 11 deletions kleobis-deploy.sh

This file was deleted.

Empty file removed ksi_build/.gitkeep
Empty file.
11 changes: 0 additions & 11 deletions ksi_build/.htaccess

This file was deleted.

8 changes: 0 additions & 8 deletions ksi_build/deploy.sh

This file was deleted.

Empty file removed naskoc_build/.gitkeep
Empty file.
11 changes: 0 additions & 11 deletions naskoc_build/.htaccess

This file was deleted.

Empty file removed naskoc_build/custom.css
Empty file.
8 changes: 0 additions & 8 deletions naskoc_build/deploy.sh

This file was deleted.

23 changes: 0 additions & 23 deletions naskoc_build/index.html

This file was deleted.

22 changes: 0 additions & 22 deletions naskoc_build/style.css

This file was deleted.

22 changes: 9 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# This is aimed at Python 3.9

# requires to run first: python3 -m pip install wheel setuptools

jinja2<3.1
jinja2==3.0.3
jupyter-client==6.1.12

jupyter
matplotlib
sqlalchemy
pandas
seaborn
numpy
mysqlclient
hide-code
jupyter==1.0.0
matplotlib==3.5.2
sqlalchemy==1.4.36
pandas==1.4.2
seaborn==0.11.2
numpy==1.22.3
hide-code==0.6.0
PyMySQL==1.1.1
66 changes: 0 additions & 66 deletions requirements_3.6.lock.txt

This file was deleted.

Loading

0 comments on commit 429d43c

Please sign in to comment.