Bug fixes for SIM-72.
[sim/o1-interface.git] / ntsimulator / deploy / base / ubuntu.Dockerfile
index 69d69ce..354ef0c 100644 (file)
@@ -20,9 +20,7 @@
 FROM ubuntu:20.04 as builder
 LABEL maintainer="alexandru.stancu@highstreet-technologies.com / adrian.lita@highstreet-technologies.com"
 
-RUN apt-get clean
-RUN apt-get update
-RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y \
+RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
     # basic tools
     tzdata build-essential git cmake pkg-config \
     # libyang dependencies
@@ -44,11 +42,11 @@ WORKDIR /opt/dev
 RUN \
     git config --global advice.detachedHead false && \
     git clone --single-branch --branch v1.7.14 https://github.com/DaveGamble/cJSON.git && \
-    git clone --single-branch --branch v1.0.225 https://github.com/CESNET/libyang.git && \
-    git clone --single-branch --branch v1.4.122 https://github.com/sysrepo/sysrepo.git && \
+    git clone --single-branch --branch v1.0.240 https://github.com/CESNET/libyang.git && \
+    git clone --single-branch --branch v1.4.140 https://github.com/sysrepo/sysrepo.git && \
     git clone --single-branch --branch libssh-0.9.2 https://git.libssh.org/projects/libssh.git && \
-    git clone --single-branch --branch v1.1.43 https://github.com/CESNET/libnetconf2.git && \
-    git clone --single-branch --branch v1.1.70 https://github.com/CESNET/netopeer2.git && \
+    git clone --single-branch --branch v1.1.46 https://github.com/CESNET/libnetconf2.git && \
+    git clone --single-branch --branch v1.1.76 https://github.com/CESNET/netopeer2.git && \
     git clone --single-branch --branch curl-7_72_0 https://github.com/curl/curl.git
 
 # build and install cJSON
@@ -137,7 +135,9 @@ COPY ./deploy/base/build_ntsim-ng.sh /opt/dev/ntsim-ng/build_ntsim-ng.sh
 RUN \
     cd /opt/dev/ntsim-ng && \
     sed -i '/argp/d' build_ntsim-ng.sh && \
-    ./build_ntsim-ng.sh
+    ./build_ntsim-ng.sh && \
+    rm -rf source && \
+    rm -f build_ntsim-ng.sh
 
 # copy SSH related scripts and keys
 COPY ./deploy/base/ca.key /home/netconf/.ssh/ca.key
@@ -153,21 +153,20 @@ COPY ./deploy/base/generate-ssh-keys.sh /home/netconf/.ssh/generate-ssh-keys.sh
 
 FROM ubuntu:20.04
 LABEL maintainer="alexandru.stancu@highstreet-technologies.com / adrian.lita@highstreet-technologies.com"
-RUN apt-get clean
-RUN apt-get update
 
-ARG BUILD_WITH_DEBUG
-ENV BUILD_WITH_DEBUG=${BUILD_WITH_DEBUG}
-RUN if [ -n "${BUILD_WITH_DEBUG}" ]; then DEBIAN_FRONTEND="noninteractive" apt-get install -y gdb valgrind ; fi
-
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
     psmisc \
+    unzip \
     openssl \
     openssh-client \
     vsftpd \
     openssh-server \
-    && rm -rf /var/lib/apt/lists/* \
-    && unset BUILD_WITH_DEBUG
+    && rm -rf /var/lib/apt/lists/*
+    
+
+ARG BUILD_WITH_DEBUG
+ENV BUILD_WITH_DEBUG=${BUILD_WITH_DEBUG}
+RUN if [ -n "${BUILD_WITH_DEBUG}" ]; then DEBIAN_FRONTEND="noninteractive" apt-get install -y gdb valgrind nano mc && unset BUILD_WITH_DEBUG; fi
 
 # add netconf user and configure access
 RUN \
@@ -197,13 +196,14 @@ COPY --from=builder /opt/dev/ntsim-ng /opt/dev/ntsim-ng
 # copy SSH related scripts and keys
 COPY --from=builder /home/netconf/.ssh /home/netconf/.ssh
 
-### FTP configuration
+### FTP and SFTP configuration
 RUN \
     mkdir /ftp && \
+    chown -R netconf:netconf /ftp && \
     mkdir /var/run/vsftpd && \
     mkdir /var/run/vsftpd/empty  && \
     mkdir /run/sshd && \
-    echo "Match User netconf\n    ChrootDirectory /ftp\n    X11Forwarding no\n    AllowTcpForwarding no\n    ForceCommand internal-sftp" >> /etc/ssh/sshd_config
+    echo "Match User netconf\n    ChrootDirectory /\n    X11Forwarding no\n    AllowTcpForwarding no\n    ForceCommand internal-sftp -d /ftp" >> /etc/ssh/sshd_config
 
 COPY ./deploy/base/vsftpd.conf /etc/vsftpd.conf
 COPY ./deploy/base/vsftpd.userlist /etc/vsftpd.userlist