From 28d3deeee8bd553d6b70b5d08ffa8a90904e6c68 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Wed, 25 May 2022 21:43:52 -0700 Subject: [PATCH] install: updated and added dockerfiles for ubuntu/centos, updated notes on install page to correlate --- Dockerfile | 100 ---------------------------------------------- Dockerfile.centos | 39 ++++++++++++++++++ Dockerfile.ubuntu | 34 ++++++++++++++++ docs/install.md | 4 +- 4 files changed, 75 insertions(+), 102 deletions(-) delete mode 100644 Dockerfile create mode 100644 Dockerfile.centos create mode 100644 Dockerfile.ubuntu diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a116becb..00000000 --- a/Dockerfile +++ /dev/null @@ -1,100 +0,0 @@ -# syntax=docker/dockerfile:1 -FROM ubuntu:20.04 -LABEL Description="CORE Docker Image" - -# define variables -ARG DEBIAN_FRONTEND=noninteractive -ARG PREFIX=/usr/local -ARG BRANCH=master -ARG CORE_TARBALL=core.tar.gz -ARG OSPF_TARBALL=ospf.tar.gz - -# install system dependencies -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - automake \ - bash \ - ca-certificates \ - ethtool \ - gawk \ - gcc \ - g++ \ - iproute2 \ - iputils-ping \ - libc-dev \ - libev-dev \ - libreadline-dev \ - libtool \ - libtk-img \ - make \ - nftables \ - python3 \ - python3-pip \ - python3-tk \ - pkg-config \ - systemctl \ - tk \ - wget \ - xauth \ - xterm \ - && apt-get clean -# install python dependencies -RUN python3 -m pip install \ - grpcio==1.27.2 \ - grpcio-tools==1.27.2 \ - poetry==1.1.7 -# retrieve, build, and install core -RUN wget -q -O ${CORE_TARBALL} https://api.github.com/repos/coreemu/core/tarball/${BRANCH} && \ - tar xf ${CORE_TARBALL} && \ - cd coreemu-core* && \ - ./bootstrap.sh && \ - ./configure && \ - make -j $(nproc) && \ - make install && \ - cd daemon && \ - python3 -m poetry build -f wheel && \ - python3 -m pip install dist/* && \ - cp scripts/* ${PREFIX}/bin && \ - mkdir /etc/core && \ - cp -n data/core.conf /etc/core && \ - cp -n data/logging.conf /etc/core && \ - mkdir -p ${PREFIX}/share/core && \ - cp -r examples ${PREFIX}/share/core && \ - echo '\ -[Unit]\n\ -Description=Common Open Research Emulator Service\n\ -After=network.target\n\ -\n\ -[Service]\n\ -Type=simple\n\ -ExecStart=/usr/local/bin/core-daemon\n\ -TasksMax=infinity\n\ -\n\ -[Install]\n\ -WantedBy=multi-user.target\ -' > /lib/systemd/system/core-daemon.service && \ - cd ../.. && \ - rm ${CORE_TARBALL} && \ - rm -rf coreemu-core* -# retrieve, build, and install ospf mdr -RUN wget -q -O ${OSPF_TARBALL} https://github.com/USNavalResearchLaboratory/ospf-mdr/tarball/master && \ - tar xf ${OSPF_TARBALL} && \ - cd USNavalResearchLaboratory-ospf-mdr* && \ - ./bootstrap.sh && \ - ./configure --disable-doc --enable-user=root --enable-group=root \ - --with-cflags=-ggdb --sysconfdir=/usr/local/etc/quagga --enable-vtysh \ - --localstatedir=/var/run/quagga && \ - make -j $(nproc) && \ - make install && \ - cd .. && \ - rm ${OSPF_TARBALL} && \ - rm -rf USNavalResearchLaboratory-ospf-mdr* -# retrieve and install emane packages -RUN wget -q https://adjacentlink.com/downloads/emane/emane-1.2.7-release-1.ubuntu-20_04.amd64.tar.gz && \ - tar xf emane*.tar.gz && \ - cd emane-1.2.7-release-1/debs/ubuntu-20_04/amd64 && \ - apt-get install -y ./emane*.deb ./python3-emane_*.deb && \ - cd ../../../.. && \ - rm emane-1.2.7-release-1.ubuntu-20_04.amd64.tar.gz && \ - rm -rf emane-1.2.7-release-1 -CMD ["systemctl", "start", "core-daemon"] diff --git a/Dockerfile.centos b/Dockerfile.centos new file mode 100644 index 00000000..509e6dfe --- /dev/null +++ b/Dockerfile.centos @@ -0,0 +1,39 @@ +# syntax=docker/dockerfile:1 +FROM centos:7 +LABEL Description="CORE Docker CentOS Image" + +# define variables +ARG PREFIX=/usr +ARG BRANCH=master + +# define environment +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG en_US.UTF-8 + +# install core +RUN yum -y update && \ + yum install -y git sudo wget tzdata unzip python3 +WORKDIR /root +RUN git clone https://github.com/coreemu/core +WORKDIR /root/core +RUN git checkout ${BRANCH} +RUN ./setup.sh +RUN . /root/.bashrc && inv install -v -p ${PREFIX} +# install emane packages and python bindings +WORKDIR /root +RUN wget -q https://adjacentlink.com/downloads/emane/emane-1.3.3-release-1.el7.x86_64.tar.gz && \ + tar xf emane-1.3.3-release-1.el7.x86_64.tar.gz && \ + cd emane-1.3.3-release-1/rpms/el7/x86_64 && \ + yum install -y epel-release && \ + yum install -y ./openstatistic*.rpm ./emane*.rpm ./python3-emane_*.rpm && \ + cd ../../../.. && \ + rm emane-1.3.3-release-1.el7.x86_64.tar.gz && \ + rm -rf emane-1.3.3-release-1 +RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protoc-3.7.1-linux-x86_64.zip && \ + mkdir protoc && \ + unzip protoc-3.7.1-linux-x86_64.zip -d protoc +WORKDIR /root/core +RUN . /root/.bashrc && PATH=/root/protoc/bin:$PATH inv install-emane -v -e v1.3.3 + +# run daemon +CMD ["core-daemon"] diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu new file mode 100644 index 00000000..32dcecf6 --- /dev/null +++ b/Dockerfile.ubuntu @@ -0,0 +1,34 @@ +# syntax=docker/dockerfile:1 +FROM ubuntu:20.04 +LABEL Description="CORE Docker Ubuntu Image" + +# define variables +ARG PREFIX=/usr/local +ARG BRANCH=master + +# define environment +ENV DEBIAN_FRONTEND=noninteractive + +# install core +RUN apt-get update && \ + apt-get install -y git sudo wget tzdata +WORKDIR /root +RUN git clone https://github.com/coreemu/core +WORKDIR /root/core +RUN git checkout ${BRANCH} +RUN ./setup.sh +RUN . /root/.bashrc && inv install -v -p ${PREFIX} +# install emane packages and python bindings +WORKDIR /root +RUN wget -q https://adjacentlink.com/downloads/emane/emane-1.3.3-release-1.ubuntu-20_04.amd64.tar.gz && \ + tar xf emane*.tar.gz && \ + cd emane-1.3.3-release-1/debs/ubuntu-20_04/amd64 && \ + apt-get install -y ./emane*.deb ./python3-emane_*.deb && \ + cd ../../../.. && \ + rm emane-1.3.3-release-1.ubuntu-20_04.amd64.tar.gz && \ + rm -rf emane-1.3.3-release-1 +WORKDIR /root/core +RUN . /root/.bashrc && inv install-emane -v -e v1.3.3 + +# run daemon +CMD ["core-daemon"] diff --git a/docs/install.md b/docs/install.md index 7af62ee3..0f15133c 100644 --- a/docs/install.md +++ b/docs/install.md @@ -218,9 +218,9 @@ You can leverage the provided Dockerfile, to run and launch CORE within a Docker git clone https://github.com/coreemu/core.git cd core # build image -sudo docker build -t core . +sudo docker build -t core. -f Dockerfile. # start container -sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged core +sudo docker run -itd --name core -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --privileged core. # enable xhost access to the root user xhost +local:root # launch core-gui