docker base and system images, and trigger docker test from travis.

This commit is contained in:
Olof Hagsand 2019-02-11 15:47:12 +01:00
parent 84d2efdedc
commit dc173e0b4c
14 changed files with 72 additions and 54 deletions

View file

@ -1,6 +1,7 @@
# Clixon base docker image
# Clixon and dockers
This directory contains sub-directories with examples of Clixon docker images:
* [base] Clixon base image (pulls code from github)
* [system] Example and test application (builds from local dir)
* [base](base/README.md) Clixon base image
* [system](system/README.md) Example and test application

View file

@ -44,9 +44,8 @@ RUN apt-get update && apt-get install -y \
RUN mkdir /clixon
WORKDIR /clixon
# Clone cligen and clixon
# Clone cligen
RUN git clone https://github.com/olofhagsand/cligen.git
RUN git clone https://github.com/clicon/clixon.git
# Build cligen
WORKDIR /clixon/cligen
@ -54,8 +53,12 @@ RUN ./configure
RUN make
RUN make install
# Build clixon
# Copy Clixon from local dir
RUN mkdir /clixon/clixon
WORKDIR /clixon/clixon
COPY clixon .
# Build clixon
RUN ./configure
RUN make
RUN make install

View file

@ -48,12 +48,16 @@ SHELL = /bin/sh
all:
echo "Run make docker to build docker image"
# (recursively) clone the repo from top-level - NOTE changes must be committed
clixon:
git clone file://$(realpath ${top_srcdir})
clean:
distclean: clean
rm -f Makefile *~ .depend
docker: Dockerfile
docker: clixon Dockerfile
sudo docker build -t $(IMG) . # --no-cache
push:

View file

@ -6,15 +6,14 @@ the IMAGE in Makefile.in and push it to another name.
The clixon docker base image can be used to build clixon
applications. It has all the whole code for a clixon release which it
downloads from git - it does not use local code (note it may even use
develop branch).
downloads from git.
See [../system/README.md] for how to build the clixon example application using the base image.
See [clixon-system](../system/README.md) for a more complete clixon image.
## Build and push
Perform the build by 'make docker'.
You may also do 'make push' if you want to push the image, but you may then consider changing the image name (in the makefile:s).
Perform the build by `make docker`.
You may also do `make push` if you want to push the image, but you may then consider changing the image name (in the makefile:s).
You may run the container directly by going directly to example and
the docker runtime scripts there

View file

@ -45,8 +45,8 @@ RUN apt-get update && apt-get install -y \
# Application-specific
RUN apt-get update && apt-get install -y nginx
# Test-specific
RUN apt-get update && apt-get install -y sudo curl procps # for test scripts
# Test-specific (for test scripts)
RUN apt-get update && apt-get install -y sudo curl procps time
# The example uses "clicon" group
RUN groupadd clicon

View file

@ -43,7 +43,7 @@ IMG = clixon/clixon-system
SHELL = /bin/sh
.PHONY: all clean depend install docker push clixon-system
.PHONY: all clean distclean docker test push depend install-include install uninstall
all:
echo "Run make docker to build docker image"
@ -61,6 +61,11 @@ distclean: clean
docker: clixon Dockerfile
sudo docker build -t $(IMG) . # --no-cache
# Start the clixon system container and run the test script
test: docker
./start.sh
sudo docker exec -it clixon-system bash -c 'cd /clixon/clixon/test; exec ./all.sh'
push:
depend:

View file

@ -48,3 +48,5 @@ To check status and then kill it:
$ sudo docker ps --all
$ ./cleanup.sh
```
You can also trigger the test scripts inside the container using `make test`.