Skip to content

Commit 303b9ba

Browse files
authored
chg:dev: use docker to build the class on travis (cloudmesh#114)
* new:dev: create docker image to build the class site * move scripts into docker folder * chg:dev: switch to ubuntu since alpine texlive is broken * chg:dev: add make rules to build and publish docker image * chg:dev: switch travis to use docker image * chg:dev: add time to docker make rules * chg:dev: try building with minimal texlive * new:dev: add make rule `dockerrun` to run the image * fix:dev: fix texlive dependencies
1 parent 7ac57d1 commit 303b9ba

File tree

5 files changed

+70
-5
lines changed

5 files changed

+70
-5
lines changed

.travis.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
language: python
2-
python:
3-
- "2.7"
4-
install: "pip install -r requirements.txt"
5-
script: make doc
1+
sudo: required
2+
services:
3+
- docker
4+
before_install:
5+
- docker pull badi/cloudmesh_classes
6+
script:
7+
- docker run -e HOST_UID=$(id -u) -e HOST_GID=$(id -g) -v $PWD:/data -it --rm badi/cloudmesh_classes make all

Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- aggressive-indent-mode: nil -*-
2+
3+
FROM ubuntu:xenial
4+
5+
ADD requirements.txt requirements.txt
6+
7+
RUN apt-get update -qq && \
8+
apt-get install -y \
9+
python \
10+
python-dev \
11+
python-pip \
12+
python-virtualenv \
13+
python-numpy \
14+
python-pandas \
15+
texlive texlive-latex-extra \
16+
graphviz \
17+
gosu
18+
19+
RUN pip install -U pip && \
20+
pip install -r requirements.txt
21+
22+
ADD docker/entry.sh entry.sh
23+
ADD docker/main.sh main.sh
24+
VOLUME /data
25+
WORKDIR /data
26+
ENTRYPOINT ["/entry.sh"]

Makefile

+17
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ notes:
5757
cd /tmp/notes-i524; echo "R" | make pdf || true
5858
cp /tmp/notes-i524/docs/build/latex/Classes.pdf .
5959

60+
61+
dockerimage: Dockerfile $(wildcard docker/*)
62+
time docker build -t badi/cloudmesh_classes . # FIXME: should be cloudmesh/classes
63+
64+
dockerpublish: dockerimage
65+
time docker push badi/cloudmesh_classes # FIXME this should be cloudmesh/classes
66+
67+
dockerrun: dockerimage
68+
time docker run \
69+
-e HOST_UID=$(shell id -u) \
70+
-e HOST_GID=$(shell id -g) \
71+
-v $(shell pwd):/data \
72+
-it \
73+
--rm \
74+
badi/cloudmesh_classes \
75+
make all
76+
6077
######################################################################
6178
# CLEANING
6279
######################################################################

docker/entry.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash -x
2+
3+
CONTAINER_UID=$(test ! -z $HOST_UID && echo $HOST_UID || echo 9999)
4+
CONTAINER_GID=$(test ! -z $HOST_GID && echo $HOST_GID || echo 9999)
5+
PROXY_USERNAME=user
6+
7+
mkdir -m 1777 -p /tmp
8+
9+
echo "Starting with $CONTAINER_UID:$CONTAINER_GID"
10+
groupadd -g $CONTAINER_GID -o $PROXY_USERNAME
11+
useradd \
12+
-d /home/$PROXY_USERNAME \
13+
-m \
14+
-u $CONTAINER_UID \
15+
-g $CONTAINER_GID \
16+
-o \
17+
$PROXY_USERNAME
18+
gosu $CONTAINER_UID:$CONTAINER_GID /main.sh $@

docker/main.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash -x
2+
exec $@

0 commit comments

Comments
 (0)