diff --git a/docker/example/Dockerfile b/docker/example/Dockerfile index 82d68c63..9ddb9cce 100644 --- a/docker/example/Dockerfile +++ b/docker/example/Dockerfile @@ -42,9 +42,8 @@ RUN apk add --update git make build-base gcc flex bison curl-dev RUN apk add --update nghttp2 # Create a directory to hold source-code, dependencies etc -RUN mkdir /clixon +RUN mkdir -p /clixon/build -RUN mkdir /clixon/build WORKDIR /clixon # Clone cligen @@ -52,34 +51,34 @@ RUN git clone https://github.com/clicon/cligen.git # Build cligen WORKDIR /clixon/cligen -RUN ./configure --prefix=/clixon/build +RUN ./configure --prefix=/usr/local RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Need to add www user manually RUN adduser -D -H -G www-data www-data # Copy Clixon from local dir -RUN mkdir /clixon/clixon +RUN mkdir -p /clixon/clixon WORKDIR /clixon/clixon COPY clixon . # Configure, build and install clixon -RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 +RUN ./configure --prefix=/usr/local --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 RUN make -RUN make install -RUN make install-include +RUN make DESTDIR=/clixon/build install +RUN make DESTDIR=/clixon/build install-include # Install main example WORKDIR /clixon/clixon/example/main RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Copy startscript WORKDIR /clixon COPY startsystem.sh startsystem.sh -RUN install startsystem.sh /clixon/build/bin/ +RUN install startsystem.sh /clixon/build/usr/local/bin/ # # Stage 2 @@ -109,7 +108,7 @@ RUN echo "Subsystem netconf /usr/local/bin/clixon_netconf" >> /etc/ssh/sshd_conf # Create clicon user and group RUN adduser -D -H clicon -COPY --from=0 /clixon/build/ /usr/local/ +COPY --from=0 /clixon/build/ / # Overwrite config file since install dirs are wrong COPY example.xml /usr/local/etc/example.xml diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile index b5017bcb..6de9a435 100644 --- a/docker/test/Dockerfile +++ b/docker/test/Dockerfile @@ -42,10 +42,8 @@ RUN apk add --update git make build-base gcc flex bison curl-dev # For netsnmp RUN apk add --update net-snmp net-snmp-dev -WORKDIR /usr/local/share - # Checkout standard YANG models for tests (note >1G for full repo) -RUN mkdir yang +RUN mkdir -p /usr/local/share/yang WORKDIR /usr/local/share/yang @@ -56,12 +54,10 @@ RUN git config core.sparseCheckout true RUN echo "standard/" >> .git/info/sparse-checkout RUN echo "experimental/" >> .git/info/sparse-checkout -WORKDIR /usr/local/share/yang RUN git pull origin main # Create a directory to hold source-code, dependencies etc -RUN mkdir /clixon -RUN mkdir /clixon/build +RUN mkdir -p /clixon/build WORKDIR /clixon # Clone cligen @@ -69,9 +65,9 @@ RUN git clone https://github.com/clicon/cligen.git # Build cligen WORKDIR /clixon/cligen -RUN ./configure --prefix=/clixon/build +RUN ./configure --prefix=/usr/local RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Copy Clixon from local dir RUN mkdir /clixon/clixon @@ -79,29 +75,26 @@ WORKDIR /clixon/clixon COPY clixon . # Configure, build and install clixon -RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --without-restconf --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ +RUN ./configure --prefix=/usr/local --with-cligen=/clixon/build --without-restconf --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Install utils (for tests) WORKDIR /clixon/clixon/util RUN make -RUN make install - -RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Copy tests WORKDIR /clixon/clixon/test -RUN install -d /clixon/build/bin/test -RUN install *.sh /clixon/build/bin/test -RUN install *.exp /clixon/build/bin/test -RUN install clixon.png /clixon/build/bin/test +RUN install -d /clixon/build/usr/local/bin/test +RUN install *.sh /clixon/build/usr/local/bin/test +RUN install *.exp /clixon/build/usr/local/bin/test +RUN install clixon.png /clixon/build/usr/local/bin/test # Copy startscript WORKDIR /clixon COPY startsystem.sh startsystem.sh -RUN install startsystem.sh /clixon/build/bin/ +RUN install startsystem.sh /clixon/build/usr/local/bin/ # Add our generated YANG files RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs @@ -131,7 +124,7 @@ RUN apk add --update sudo curl procps grep make bash expect # Create clicon user and group RUN adduser -D -H clicon -COPY --from=0 /clixon/build/ /usr/local/ +COPY --from=0 /clixon/build/ / COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/ COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/ diff --git a/docker/test/Dockerfile.fcgi b/docker/test/Dockerfile.fcgi index d0375926..be67f5e3 100644 --- a/docker/test/Dockerfile.fcgi +++ b/docker/test/Dockerfile.fcgi @@ -41,32 +41,28 @@ RUN apk add --update git make build-base gcc flex bison fcgi-dev curl-dev # For netsnmp RUN apk add --update net-snmp net-snmp-dev -# Checkut models -WORKDIR /usr/local/share/ - # Checkout standard YANG models for tests (note >1G for full repo) -RUN mkdir yang +RUN mkdir -p /usr/local/share/yang WORKDIR /usr/local/share/yang RUN git config --global init.defaultBranch master -RUN git init; -RUN git remote add -f origin https://github.com/YangModels/yang; +RUN git init +RUN git remote add -f origin https://github.com/YangModels/yang RUN git config core.sparseCheckout true RUN echo "standard/" >> .git/info/sparse-checkout RUN echo "experimental/" >> .git/info/sparse-checkout RUN git pull origin main -RUN mkdir /usr/local/share/openconfig +RUN mkdir -p /usr/local/share/openconfig WORKDIR /usr/local/share/openconfig # Checkut Openconfig models for tests RUN git clone https://github.com/openconfig/public # Create a directory to hold source-code, dependencies etc -RUN mkdir /clixon -RUN mkdir /clixon/build +RUN mkdir -p /clixon/build WORKDIR /clixon # Clone cligen @@ -74,12 +70,12 @@ RUN git clone https://github.com/clicon/cligen.git # Build cligen WORKDIR /clixon/cligen -RUN ./configure --prefix=/clixon/build +RUN ./configure --prefix=/usr/local --sysconfdir=/etc RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Copy Clixon from local dir -RUN mkdir /clixon/clixon +RUN mkdir -p /clixon/clixon WORKDIR /clixon/clixon COPY clixon . @@ -89,27 +85,28 @@ RUN adduser -D -H -G www-data www-data RUN apk add --update nginx # Configure, build and install clixon -RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=fcgi --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ +RUN ./configure --prefix=/usr/local --sysconfdir=/etc --with-cligen=/clixon/build --with-restconf=fcgi --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Install utils (for tests) WORKDIR /clixon/clixon/util RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Build and install the clixon example WORKDIR /clixon/clixon/example/main RUN make -RUN make install +RUN make DESTDIR=/clixon/build install +RUN mkdir -p /clixon/build/etc RUN install example.xml /clixon/build/etc/clixon.xml # Copy tests WORKDIR /clixon/clixon/test -RUN install -d /clixon/build/bin/test -RUN install *.sh /clixon/build/bin/test -RUN install *.exp /clixon/build/bin/test -RUN install clixon.png /clixon/build/bin/test +RUN install -d /clixon/build/usr/local/bin/test +RUN install *.sh /clixon/build/usr/local/bin/test +RUN install *.exp /clixon/build/usr/local/bin/test +RUN install clixon.png /clixon/build/usr/local/bin/test RUN install -d /clixon/build/mibs RUN install mibs/* /clixon/build/mibs @@ -117,7 +114,7 @@ RUN install mibs/* /clixon/build/mibs # Copy startscript WORKDIR /clixon COPY startsystem_fcgi.sh startsystem.sh -RUN install startsystem.sh /clixon/build/bin/ +RUN install startsystem.sh /clixon/build/usr/local/bin/ # Add our generated YANG files RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs @@ -157,7 +154,7 @@ RUN adduser -D -H clicon RUN adduser nginx clicon RUN adduser www-data clicon -COPY --from=0 /clixon/build/ /usr/local/ +COPY --from=0 /clixon/build/ / COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/ COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/ COPY --from=0 /clixon/build/mibs/* /usr/share/snmp/mibs/ diff --git a/docker/test/Dockerfile.native b/docker/test/Dockerfile.native index c70cf180..7706770b 100644 --- a/docker/test/Dockerfile.native +++ b/docker/test/Dockerfile.native @@ -44,32 +44,28 @@ RUN apk add --update nghttp2 # For netsnmp RUN apk add --update net-snmp net-snmp-dev -# Checkut models -WORKDIR /usr/local/share/ - # Checkout standard YANG models for tests (note >1G for full repo) -RUN mkdir yang +RUN mkdir -p /usr/local/share/yang WORKDIR /usr/local/share/yang RUN git config --global init.defaultBranch master -RUN git init; -RUN git remote add -f origin https://github.com/YangModels/yang; +RUN git init +RUN git remote add -f origin https://github.com/YangModels/yang RUN git config core.sparseCheckout true RUN echo "standard/" >> .git/info/sparse-checkout RUN echo "experimental/" >> .git/info/sparse-checkout RUN git pull origin main -RUN mkdir /usr/local/share/openconfig +RUN mkdir -p /usr/local/share/openconfig WORKDIR /usr/local/share/openconfig # Checkut Openconfig models for tests RUN git clone https://github.com/openconfig/public # Create a directory to hold source-code, dependencies etc -RUN mkdir /clixon -RUN mkdir /clixon/build +RUN mkdir -p /clixon/build WORKDIR /clixon # Clone cligen @@ -77,41 +73,42 @@ RUN git clone https://github.com/clicon/cligen.git # Build cligen WORKDIR /clixon/cligen -RUN ./configure --prefix=/clixon/build +RUN ./configure --prefix=/usr/local --sysconfdir=/etc RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Need to add www user manually RUN adduser -D -H -G www-data www-data # Copy Clixon from local dir -RUN mkdir /clixon/clixon +RUN mkdir -p /clixon/clixon WORKDIR /clixon/clixon COPY clixon . # Configure, build and install clixon -RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ +RUN ./configure --prefix=/usr/local --sysconfdir=/etc --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Install utils (for tests) WORKDIR /clixon/clixon/util RUN make -RUN make install +RUN make DESTDIR=/clixon/build install # Build and install the clixon example WORKDIR /clixon/clixon/example/main RUN make -RUN make install +RUN make DESTDIR=/clixon/build install +RUN mkdir -p /clixon/build/etc RUN install example.xml /clixon/build/etc/clixon.xml # Copy tests WORKDIR /clixon/clixon/test -RUN install -d /clixon/build/bin/test -RUN install *.sh /clixon/build/bin/test -RUN install *.exp /clixon/build/bin/test -RUN install clixon.png /clixon/build/bin/test +RUN install -d /clixon/build/usr/local/bin/test +RUN install *.sh /clixon/build/usr/local/bin/test +RUN install *.exp /clixon/build/usr/local/bin/test +RUN install clixon.png /clixon/build/usr/local/bin/test RUN install -d /clixon/build/mibs RUN install mibs/* /clixon/build/mibs @@ -119,7 +116,7 @@ RUN install mibs/* /clixon/build/mibs # Copy startscript WORKDIR /clixon COPY startsystem_native.sh startsystem.sh -RUN install startsystem.sh /clixon/build/bin/ +RUN install startsystem.sh /clixon/build/usr/local/bin/ # Add our generated YANG files RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs @@ -161,7 +158,7 @@ EXPOSE 443/tcp # Create clicon user and group RUN adduser -D -H clicon -COPY --from=0 /clixon/build/ /usr/local/ +COPY --from=0 /clixon/build/ / COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/ COPY --from=0 /usr/local/share/openconfig/* /usr/local/share/openconfig/ COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/