From 6d376ab3264bd75867ee5c601b8548212d76e571 Mon Sep 17 00:00:00 2001 From: Paras Jain Date: Tue, 21 Dec 2021 09:52:40 -0800 Subject: [PATCH] Build Python docker image (#12) --- .dockerignore | 38 ++++++++++++++++++++++++++++++++++++++ Dockerfile | 4 ++++ scripts/pack_docker.sh | 15 +++++++++++++++ setup.py | 10 +++++----- 4 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 scripts/pack_docker.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..6da60bfd2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,38 @@ +data/ +nb/ +Dockerfile + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +.ipynb_checkpoints/ +nb/.ipynb_checkpoints/ +.idea/ +.vscode/ + +.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..70d3d37e3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +# syntax=docker/dockerfile:1 +FROM ghcr.io/parasj/skylark-docker-base:main +COPY . /pkg +RUN pip install /pkg \ No newline at end of file diff --git a/scripts/pack_docker.sh b/scripts/pack_docker.sh new file mode 100644 index 000000000..64ab57cc4 --- /dev/null +++ b/scripts/pack_docker.sh @@ -0,0 +1,15 @@ +#!/bin/bash +export DOCKER_BUILDKIT=1 +cd "$(dirname "$0")/.." +mkdir -p ./dist + +set -xe +sudo docker build -t skylark . +# sudo docker save skylark | pv > ./dist/skylark.tar +# du -sh ./dist/skylark.tar + +RANDOM_TAG=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1) +sudo docker tag skylark ghcr.io/parasj/skylark-docker:$RANDOM_TAG +sudo docker push ghcr.io/parasj/skylark-docker:$RANDOM_TAG +echo "Code stored in ghcr.io/parasj/skylark-docker:$RANDOM_TAG" +export SKYLARK_DOCKER_IMAGE="ghcr.io/parasj/skylark-docker:$RANDOM_TAG" \ No newline at end of file diff --git a/setup.py b/setup.py index 73331cdf8..7256bbbb5 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ from setuptools import setup + setup( name='skylark', version='0.1', @@ -7,20 +8,19 @@ python_requires=">=3.8", install_requires=[ "boto3", - # "cylp", - "cvxpy", - "cvxopt", "click", - "google-cloud-compute", + "cvxopt", + "cvxpy", "google-api-python-client", + "google-cloud-compute", "graphviz", "loguru", "matplotlib", "numpy", "pandas", "paramiko", - "tqdm", "questionary", + "tqdm", ], extras_require={"test": ["black", "pytest", "ipython", "jupyter_console"]} ) \ No newline at end of file