Permalink
Browse files

Adding circleci to project

  • Loading branch information...
sachinruk committed Mar 1, 2018
1 parent 54c9f39 commit ae6718fc14f3ac499697c97edc97a66dad9d9a6c
Showing with 89 additions and 1 deletion.
  1. +27 −0 .circleci/config.yml
  2. +38 −1 Dockerfile
  3. +24 −0 build_script.py
@@ -0,0 +1,27 @@
version: 2
jobs:
build:
docker:
- image: ubuntu # (1)
working_directory: ~/build
steps:
- checkout
- setup_remote_docker:
reusable: true
# use a primary image that already has Docker (recommended)
# or install it during a build like we do here
- run:
name: Install Docker client
command: |
apt-get update && apt-get install -y curl python3 git
set -x
VER="17.03.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
# build and push Docker image
- run: |
docker login -u $DOCKER_USER -p $DOCKER_PASS
chmod +x build_script.py
python3 build_script.py 0.1.$CIRCLE_BUILD_NUM
@@ -1 +1,38 @@
FROM sachinruk/ml_class
FROM ubuntu
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl -qsSLkO \
https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-`uname -p`.sh \
&& bash Miniconda3-latest-Linux-`uname -p`.sh -b \
&& rm Miniconda3-latest-Linux-`uname -p`.sh
ENV PATH=/root/miniconda3/bin:$PATH
RUN conda install -y \
h5py \
pandas \
jupyter \
matplotlib \
seaborn \
scikit-learn \
pandas
RUN conda config --append channels conda-forge
RUN conda install -y tensorflow keras
RUN conda clean --yes --tarballs --packages --source-cache
RUN apt-get update && apt-get install -y graphviz xvfb python-opengl
RUN pip install graphviz xgboost
VOLUME /notebook
WORKDIR /notebook
EXPOSE 8888
CMD xvfb-run -s "-screen 0 1400x900x24" jupyter notebook --allow-root --no-browser --ip=0.0.0.0 --NotebookApp.token=
@@ -0,0 +1,24 @@
import os
import sys
import subprocess
from subprocess import call
out = subprocess.check_output("git diff --name-only HEAD~1 HEAD".split())
out = out.decode('ascii').split('\n')[:-1]
dockerfiles = [files for files in out if "Dockerfile" in files]
def call_cmd(cmd):
ret_code = call(cmd.split())
if ret_code != 0:
print("The following command failed: " + cmd)
sys.exit(ret_code)
TAG = str(sys.argv[1])
if len(dockerfiles)>0:
tagged_version = "sachinruk/deepschoolio:" + TAG
call_cmd("docker build -t sachinruk/deepschoolio .")
call_cmd("docker tag sachinruk/deepschoolio " + tagged_version)
call_cmd("docker push sachinruk/deepschoolio")
print("="*50)
print(" built!")
print("="*50)

0 comments on commit ae6718f

Please sign in to comment.