From 11d1788370c15b162ba8b3da590022eabf9e8896 Mon Sep 17 00:00:00 2001 From: Olof Hagsand Date: Tue, 18 Aug 2020 15:24:50 +0000 Subject: [PATCH] docker base use evhtp --- docker/base/Dockerfile | 44 +++++++++++++++++++++++++++-------------- docker/base/Makefile.in | 3 ++- docker/base/README.md | 2 +- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index af593366..be8d3792 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -1,7 +1,8 @@ # # ***** BEGIN LICENSE BLOCK ***** # -# Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren +# Copyright (C) 2017-2019 Olof Hagsand +# Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) # # This file is part of CLIXON # @@ -35,10 +36,26 @@ FROM alpine MAINTAINER Olof Hagsand # For clixon and cligen -RUN apk add --update git make build-base gcc flex bison fcgi-dev curl-dev +RUN apk add --update git make build-base gcc flex bison curl-dev # Create a directory to hold source-code, dependencies etc RUN mkdir /clixon + +# libevht +# dependencies +RUN apk add --update libevent cmake libevent-dev + +# clone libevhtp +WORKDIR /clixon +RUN git clone https://github.com/criticalstack/libevhtp.git +WORKDIR /clixon/libevhtp/build +RUN cmake -DEVHTP_DISABLE_REGEX=ON -DEVHTP_DISABLE_EVTHR=ON .. +RUN make +RUN make install + +# NOTE: Patch include queue.h to use the queue.h included in the evhtp release instead +RUN (cd /usr/local/include/evhtp/; sed -i -e 's///' evhtp.h) + RUN mkdir /clixon/build WORKDIR /clixon @@ -58,40 +75,38 @@ COPY clixon . # Need to add www user manually RUN adduser -D -H www-data -# nginx adds group www-data -RUN apk add --update nginx # Configure, build and install clixon -RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-wwwuser=www-data +RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-wwwuser=www-data --enable-optyangs --with-restconf=evhtp + RUN make RUN make install -# Build and install the clixon hello example (not really necessary for base) -WORKDIR /clixon/clixon/example/hello RUN make RUN make install -RUN install hello.xml /clixon/build/etc/clixon.xml # For 2nd level # # Stage 2 -# +# The second step skips the development environment and builds a runtime system FROM alpine MAINTAINER Olof Hagsand # For clixon and cligen -RUN apk add --update flex bison fcgi-dev +RUN apk add --update flex bison # need to add www user manually RUN adduser -D -H www-data -# nginx adds group www-data -RUN apk add --update nginx +# for libevtp +RUN apk add --update openssl libevent -# Expose nginx port for restconf +# Test-specific (for test scripts) XXX Maybe remove those? +RUN apk add --update sudo curl procps grep make bash + +# Expose https port for restconf EXPOSE 80 # Create clicon user and group RUN adduser -D -H clicon -RUN adduser nginx clicon RUN adduser www-data clicon COPY --from=0 /clixon/build/ /usr/local/ @@ -102,4 +117,3 @@ RUN chown www-data /www-data RUN chgrp www-data /www-data - diff --git a/docker/base/Makefile.in b/docker/base/Makefile.in index 3fa15155..9e7c1ae5 100644 --- a/docker/base/Makefile.in +++ b/docker/base/Makefile.in @@ -1,7 +1,8 @@ # # ***** BEGIN LICENSE BLOCK ***** # -# Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren +# Copyright (C) 2017-2019 Olof Hagsand +# Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) # # This file is part of CLIXON # diff --git a/docker/base/README.md b/docker/base/README.md index 755c9180..a44e611e 100644 --- a/docker/base/README.md +++ b/docker/base/README.md @@ -25,7 +25,7 @@ The base container is a minimal and primitive example. Look at the [clixon-syste The following shows a simple example of how to run the example application. First, the container is started with the backend running: ``` - $ sudo docker run --rm --name hello -d clixon/clixon clixon_backend -Fs init + $ sudo docker run --rm --name cli -d clixon/clixon clixon_backend -Fs init ``` Then a CLI is started, and finally the container is removed: ```