aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore6
-rw-r--r--.gitignore5
-rw-r--r--Dockerfile25
-rw-r--r--Procfile2
-rw-r--r--dodo.py23
5 files changed, 57 insertions, 4 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..2b6c642
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+__pycache__
+/.doit.db
+/build
+/dist
+/node_modules
+/yarn-error.log
diff --git a/.gitignore b/.gitignore
index a5ee654..2b6c642 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
__pycache__
+/.doit.db
/build
/dist
-/.doit.*
-/yarn-error.log
/node_modules
-/src_py/opcut/json_validator.py
+/yarn-error.log
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..0e093c5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,25 @@
+FROM python:3.8-buster AS base
+
+
+FROM base AS build
+
+RUN apt-get update \
+ && apt-get install -q -y nodejs yarnpkg \
+ && ln -s /usr/bin/yarnpkg /usr/bin/yarn
+
+COPY . /opcut
+
+RUN cd /opcut \
+ && pip install -r requirements.txt \
+ && doit
+
+
+FROM base AS run
+
+COPY --from=build /opcut/dist /opcut/dist
+
+RUN pip install /opcut/dist/*
+
+EXPOSE 80
+
+CMD ["opcut", "server", "--addr", "http://0.0.0.0:80"]
diff --git a/Procfile b/Procfile
index 531e0f2..175affd 100644
--- a/Procfile
+++ b/Procfile
@@ -1 +1 @@
-web: python -m opcut.main server --ui-addr http://0.0.0.0:$PORT
+web: python -m opcut.main server --addr http://0.0.0.0:$PORT
diff --git a/dodo.py b/dodo.py
index 176a393..5951fb7 100644
--- a/dodo.py
+++ b/dodo.py
@@ -28,6 +28,8 @@ dist_dir = Path('dist')
py_build_dir = build_dir / 'py'
js_build_dir = build_dir / 'js'
+docker_img = 'bozokopic/opcut'
+
def task_clean_all():
"""Clean all"""
@@ -110,6 +112,27 @@ def task_dist():
'task_dep': ['py_build']}
+def task_docker_build():
+ """Create docker image"""
+ def build():
+ version = _get_version()
+ subprocess.run(['docker', 'build', '-t', f'{docker_img}:{version}',
+ '.'],
+ check=True)
+
+ return {'actions': [build]}
+
+
+def task_docker_upload():
+ """Upload docker image"""
+ def upload():
+ version = _get_version()
+ subprocess.run(['docker', 'push', f'{docker_img}:{version}'],
+ check=True)
+
+ return {'actions': [upload]}
+
+
def _create_setup_py(path):
version = _get_version()
readme = _get_readme()