More on clixon base container on Alpine
This commit is contained in:
parent
973e5d7507
commit
f02310dcef
7 changed files with 62 additions and 13 deletions
|
|
@ -37,11 +37,11 @@ MAINTAINER Olof Hagsand <olof@hagsand.se>
|
|||
# For clixon and cligen
|
||||
RUN apk add --update git make build-base gcc flex bison fcgi-dev curl-dev
|
||||
|
||||
# For debug
|
||||
RUN apk add --update bash nano
|
||||
|
||||
# Create a directory to hold source-code, dependencies etc
|
||||
RUN mkdir /clixon
|
||||
RUN mkdir /clixon/build
|
||||
|
||||
WORKDIR /clixon
|
||||
|
||||
# Clone cligen
|
||||
|
|
@ -49,7 +49,7 @@ RUN git clone https://github.com/olofhagsand/cligen.git
|
|||
|
||||
# Build cligen
|
||||
WORKDIR /clixon/cligen
|
||||
RUN ./configure
|
||||
RUN ./configure --prefix=/clixon/build
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
|
|
@ -59,11 +59,33 @@ WORKDIR /clixon/clixon
|
|||
COPY clixon .
|
||||
|
||||
# Build clixon (without restconf if you dont have nginx)
|
||||
RUN ./configure --without-restconf
|
||||
RUN ./configure --without-restconf --prefix=/clixon/build --with-cligen=/clixon/build
|
||||
RUN make
|
||||
RUN make install
|
||||
RUN make install-include
|
||||
|
||||
WORKDIR /clixon/clixon/example
|
||||
RUN DESTDIR=/clixon/build make
|
||||
RUN make install
|
||||
|
||||
#
|
||||
# Stage 2
|
||||
#
|
||||
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update flex bison # fcgi-dev curl-dev
|
||||
|
||||
# Run a clicon group - actually an application may want another
|
||||
RUN addgroup clicon
|
||||
|
||||
COPY --from=0 /clixon/build/ /usr/local/
|
||||
|
||||
# For debug
|
||||
#RUN apk add --update bash nano
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,3 +20,28 @@ the docker runtime scripts there
|
|||
|
||||
(You may have to login for push with sudo docker login -u <username>)
|
||||
|
||||
## Example run
|
||||
|
||||
The following shows a simple example of how to run the example
|
||||
application. First,the container is started, then the backend is startend in the background inside the container, and finally the CLI is started in the foreground.
|
||||
|
||||
```
|
||||
$ sudo docker run --name clixon --rm -td clixon/clixon
|
||||
$ sudo docker exec -it clixon clixon_backend -s init -f /usr/local/etc/example.xml
|
||||
$ sudo docker exec -it clixon clixon_cli -f /usr/local/etc/example.xml
|
||||
> set interfaces interface e
|
||||
> show configuration
|
||||
interfaces {
|
||||
interface {
|
||||
name e;
|
||||
enabled true;
|
||||
}
|
||||
}
|
||||
> q
|
||||
$ sudo docker kill clixon
|
||||
```
|
||||
|
||||
Note that this is a special case since the example is
|
||||
already a part of the installation. If you want to add your own
|
||||
application, such as plugins, cli syntax files, yang models, etc, you
|
||||
need to extend the base container with your own additions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue