Commit 3339cbf8 authored by Yann Garcia's avatar Yann Garcia
Browse files

Update Dockerfile

parent 768ca75d
Loading
Loading
Loading
Loading
Loading
+17 −40
Original line number Diff line number Diff line
FROM alpine:latest

# Install dependencies
RUN apk update && \
    apk add --no-cache 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
FROM stfubuntu:20.04

# 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
MAINTAINER ETSI TTF T027

# Clone Titan
WORKDIR /home/etsi
RUN mkdir -p frameworks dev tmp && cd frameworks && git clone https://github.com/eclipse/titan.core.git || exit 1
WORKDIR /home/etsi/frameworks/titan.core/
LABEL description="TTF_T027_Mec Docker Image"

# 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
ENV TERM=linux \
    HOME=/home/etsi \
    HOSTNAME=docker-titan-TTF_T027

# 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
COPY home /home/etsi

# Build Titan
RUN \
    sed --in-place 's/LINUX_LIBS     := -lxml2/LINUX_LIBS     := -lxml2 -lpthread/g' ./core/Makefile && \
    make install && make clean || exit 1
RUN cd /home/etsi \
    && chown -R etsi:etsi . \
    && ls ./etc/init.d/*.sh | while read S; do chmod 0750 "$S" || exit 1; done

WORKDIR /home/etsi/dev
USER etsi

ENV ATS=AtsCise
RUN cd ${HOME} \
    && export PATH=$HOME/bin:$PATH \
    && ls ${HOME}/etc/init.d/*.sh | while read S; do /bin/bash -c "$S" || exit 1; done \
    && rm -fr ${HOME}/etc

EXPOSE 30181/tcp
CMD ["/bin/bash"]

ENTRYPOINT /home/yann/dev/cise/virtualization/docker/docker-entrypoint.sh
# That's all Floks