updated dockerfiles to run commands to save space optimally

This commit is contained in:
Blake Harnden 2023-03-02 08:34:54 -08:00
parent fec400ac2e
commit d45eeb6d2e
8 changed files with 223 additions and 433 deletions

View file

@ -2,43 +2,61 @@
FROM ubuntu:22.04
LABEL Description="CORE Docker Ubuntu Image"
# define variables
ARG PREFIX=/usr/local
ARG BRANCH=master
# define environment
ARG PROTOC_VERSION=3.19.6
ARG VENV_PATH=/opt/core/venv
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH="$PATH:${VENV_PATH}/bin"
WORKDIR /opt
# install basic dependencies
RUN apt-get update && \
apt-get install -y git sudo wget tzdata
# install system dependencies
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
ca-certificates \
git \
sudo \
wget \
tzdata \
libpcap-dev \
libpcre3-dev \
libprotobuf-dev \
libxml2-dev \
protobuf-compiler \
unzip \
uuid-dev \
iproute2 \
iputils-ping \
tcpdump && \
apt-get autoremove -y
# install core
WORKDIR /opt
RUN git clone https://github.com/coreemu/core
WORKDIR /opt/core
RUN git checkout ${BRANCH}
RUN ./setup.sh
RUN . /root/.bashrc && inv install -v -p ${PREFIX}
ENV PATH "$PATH:/opt/core/venv/bin"
RUN git clone https://github.com/coreemu/core && \
cd core && \
git checkout ${BRANCH} && \
./setup.sh && \
. /root/.bashrc && \
inv install -v -p ${PREFIX} && \
cd /opt && \
rm -rf ospf-mdr
# install emane
RUN apt-get install -y libpcap-dev libpcre3-dev libprotobuf-dev libxml2-dev protobuf-compiler unzip uuid-dev
WORKDIR /opt
RUN git clone https://github.com/adjacentlink/emane.git
RUN cd emane && \
./autogen.sh && \
./configure --prefix=/usr && \
make -j$(nproc) && \
make install
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.6/protoc-3.19.6-linux-x86_64.zip && \
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
mkdir protoc && \
unzip protoc-3.19.6-linux-x86_64.zip -d protoc
RUN PATH=/opt/protoc/bin:$PATH && \
cd emane/src/python && \
make clean && \
make
RUN /opt/core/venv/bin/python -m pip install emane/src/python
unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d protoc && \
git clone https://github.com/adjacentlink/emane.git && \
cd emane && \
./autogen.sh && \
./configure --prefix=/usr && \
make -j$(nproc) && \
make install && \
cd src/python && \
make clean && \
PATH=/opt/protoc/bin:$PATH make && \
${VENV_PATH}/bin/python -m pip install . && \
cd /opt && \
rm -rf protoc && \
rm -rf emane && \
rm -f protoc-${PROTOC_VERSION}-linux-x86_64.zip
# run daemon
CMD ["core-daemon"]
WORKDIR /root