Skip to content

Commit 2ec6cb2

Browse files
committed
Creating various stages images
The point of this is that images that require source code (the MBE and PB images) shouldn't used cached images. But I want to use cached images for the other two because that will save a lot of build time. Doing it this way makes it relatively easy to update the images by using caching when I should and not when I shouldn't. The last image (PB, short for pubbook) runs the 'pubbook' command so the container is all set to be run as an application container. Now I just need to make sure the POST handler does what it needs to do. That I can test locally without really having to build the container until I need to deploy it.
1 parent bf97b41 commit 2ec6cb2

File tree

6 files changed

+94
-67
lines changed

6 files changed

+94
-67
lines changed

docker/Dockerfile

Lines changed: 0 additions & 67 deletions
This file was deleted.

docker/MBE/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This is a Dockerfile that creates a docker image with all the necessary
2+
# dependencies for building the book.
3+
4+
FROM xogeny/py
5+
6+
# Create a directory for all the book related stuff
7+
RUN mkdir /opt/MBE
8+
9+
# The rest of this we do as a user
10+
RUN useradd builder
11+
12+
RUN chown builder /opt/MBE
13+
14+
USER builder
15+
16+
WORKDIR /opt/MBE
17+
18+
RUN git clone https://github.com/xogeny/ModelicaBook.git

docker/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
images:
2+
docker build -t xogeny/om OM
3+
docker build -t xogeny/py PY
4+
docker build --no-cache=true -t xogeny/mbe MBE
5+
docker build -t xogeny/pubbook PB

docker/OM/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This is a Dockerfile that creates a docker image with all the necessary
2+
# dependencies for building the book.
3+
4+
FROM ubuntu
5+
6+
# Update index
7+
RUN apt-get update
8+
9+
# Install weget
10+
RUN apt-get install -y wget
11+
12+
# Add OpenModelica stable build
13+
RUN for deb in deb deb-src; do echo "$deb http://build.openmodelica.org/apt `lsb_release -cs` stable"; done | sudo tee /etc/apt/sources.list.d/openmodelica.list
14+
RUN wget -q http://build.openmodelica.org/apt/openmodelica.asc -O- | sudo apt-key add -
15+
16+
# Update index (again)
17+
RUN apt-get update
18+
19+
# Install OpenModelica
20+
RUN apt-get install -y openmodelica

docker/PB/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This is a Dockerfile that creates a docker image with all the necessary
2+
# dependencies for building the book.
3+
4+
FROM xogeny/mbe
5+
6+
USER root
7+
8+
# Now install a few more bits needed by Go
9+
RUN apt-get update -y && apt-get install --no-install-recommends -y -q curl build-essential ca-certificates git mercurial bzr
10+
11+
# And then install Go itself
12+
RUN mkdir /goroot && curl https://storage.googleapis.com/golang/go1.3.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1
13+
14+
# Setup GO environment variables
15+
ENV GOROOT /goroot
16+
ENV GOPATH /opt/MBE/ModelicaBook/docker/gopath
17+
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
18+
19+
USER builder
20+
21+
WORKDIR /opt/MBE
22+
23+
EXPOSE 8080
24+
25+
RUN go install xogeny/pubbook
26+
27+
CMD ["pubbook"]

docker/PY/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This is a Dockerfile that creates a docker image with all the necessary
2+
# dependencies for building the book.
3+
4+
FROM xogeny/om
5+
6+
# Now Install base Python
7+
RUN apt-get install -y python python-dev python-pip python-virtualenv
8+
9+
# Now a bunch of dependencies required for building the book
10+
RUN apt-get install -y calibre
11+
RUN apt-get install -y librsvg2-bin
12+
RUN apt-get install -y texlive-fonts-recommended
13+
RUN apt-get install -y texlive-latex-recommended
14+
RUN apt-get install -y texlive-latex-extra
15+
RUN apt-get install -y python-matplotlib
16+
RUN apt-get install -y python-pip
17+
RUN apt-get install -y python-scipy
18+
RUN apt-get install -y python-sphinx
19+
20+
# Finally, upgrade Pygments to the latest Modelica syntax rules
21+
RUN pip install --upgrade https://bitbucket.org/dietmarw/pygments-main/get/default.tar.gz
22+
23+
# Now install Git and grab the book
24+
RUN apt-get install -y git

0 commit comments

Comments
 (0)