Dockerfile 1.96 KB
Newer Older
FROM alpine:latest

# Install dependencies
RUN apk update && \
    apk add --no-cache autoconf automake sudo make git g++ diffutils expect openssl-dev libxml2-dev libxml2-utils libxslt-dev libtool ncurses-dev jsoncpp-dev readline-dev flex bison perl libexecinfo-dev bash libedit libedit-dev lksctp-tools lksctp-tools-dev libpcap-dev

# Create user and sudouser
RUN \
    addgroup -g 1000 etsi && \
    adduser -S -D -u 1000 -G etsi -h /home/etsi -s /bin/bash etsi && \
    echo "etsi:etsi" | chpasswd  && \
    echo "etsi ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers || exit 1 
USER etsi

# Setup Hosts file at the boot time
RUN \
    echo 'sudo sh -c "cp /etc/hosts /etc/append && (echo \"127.0.1.1  $HOSTNAME\"; cat /etc/append) > /etc/hosts"' >> /home/etsi/.bashrc \
    echo 'sh' >> /home/etsi/.bashrc || exit 1

# Clone OSIP
WORKDIR /home/etsi
RUN \
    mkdir -p frameworks dev tmp && cd frameworks \
    && cd ${HOME}/frameworks \
    && git clone https://git.savannah.gnu.org/git/osip.git ./osip \
    && cd osip \
    && ./autogen.sh \
    && ./configure --prefix=/home/etsi \
    && make && make install \
    && cd - || exit 1

# Clone Titan
RUN git clone https://github.com/eclipse/titan.core.git || exit 1
WORKDIR /home/etsi/frameworks/titan.core/

# Setup ENV variables
ENV TTCN3_DIR=/home/etsi/frameworks/titan.core/Install
ENV PATH=$TTCN3_DIR/bin:$PATH \
    LD_LIBRARY_PATH=$TTCN3_DIR/lib:$LD_LIBRARY_PATH

# Set flags
RUN \
    echo "ALPINE_LINUX=yes" > Makefile.personal && \
    echo "TTCN3_DIR=$TTCN3_DIR" >> Makefile.personal && \
    echo "JNI=no" >> Makefile.personal && \
    echo "GUI=no" >> Makefile.personal && \
    echo "DEBUG=no" >> Makefile.personal || exit 1

# Build Titan
RUN \
    sed --in-place 's/LINUX_LIBS     := -lxml2/LINUX_LIBS     := -lxml2 -lpthread/g' ./core/Makefile && \
    make install && make clean || exit 1

WORKDIR /home/etsi/dev

EXPOSE 443/tcp
EXPOSE 5060/udp
EXPOSE 5061/udp

ENTRYPOINT /home/yann/dev/cise/virtualization/docker/docker-entrypoint.sh