Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/build_config/docker/Dockerfile.ubuntu.git
185785 views
# to build this image run the following command
# $ docker build -t sumo - < Dockerfile.ubuntu.git
# to use it run (GUI applications need more work)
# $ docker run -it sumo bash
# now you have a bash inside a docker container and can for instance run
# $ cd /opt/sumo; bin/sumo -c docs/examples/sumo/busses/test.sumocfg
# This Dockerfile installs everything for a full fledged SUMO with all tools runnable.
# If you don't need certain features and rather have a smaller container you can comment the unneeded parts below

# We are dividing the build into multiple stages to reduce the size of the resulting image
FROM ubuntu:jammy AS build

ENV SUMO_HOME=/usr/share/sumo
ARG DEBIAN_FRONTEND=noninteractive
ARG JUPEDSIM_VERSION=v1.3.1

RUN apt-get -qq update && \
    apt-get -y install git ca-certificates lsb-release wget

RUN cd /opt; git clone --shallow-submodules --single-branch --recursive https://github.com/eclipse-sumo/sumo

# basic build dependencies
RUN apt-get -y install $(cat /opt/sumo/build_config/build_req_deb.txt)
# 3D GUI, video recording
RUN apt-get -y install libavformat-dev libopenscenegraph-dev libswscale-dev
# Parquet / Arrow
RUN wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get -y install ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get -qq update && \
    apt-get -y install libarrow-dev libparquet-dev
# packages needed for the tools (some are also listed in tools/requirements.txt but we prefer the ubuntu packages)
RUN apt-get -y install $(cat /opt/sumo/build_config/tools_req_deb.txt)

# JuPedSim
RUN cd /opt; git clone -b $JUPEDSIM_VERSION https://github.com/PedestrianDynamics/jupedsim
RUN cd /opt; cmake -B jupedsim-build -D CMAKE_INSTALL_PREFIX=/install/usr jupedsim; \
 cmake --build jupedsim-build -j4 --config Release; cmake --install jupedsim-build --config Release

# python packages needed for the tools (the ones where we do not have ubuntu packages)
RUN pip3 install -r /opt/sumo/tools/requirements.txt
# python packages needed for the docs (the ones where we do not have ubuntu packages)
RUN pip3 install -r /opt/sumo/docs/web/requirements.txt

RUN cd /opt/sumo; cmake -B cmake-build -DCMAKE_INSTALL_PREFIX=/install/usr -DSUMO_UTILS=TRUE; \
 cd cmake-build; make -j8 all examples doc install

# Now create actual image
FROM ubuntu:jammy

# Add metadata
LABEL org.opencontainers.image.authors="SUMO Developers <[email protected]>" \
      org.opencontainers.image.url="https://ghcr.io/eclipse-sumo/sumo" \
      org.opencontainers.image.source="https://github.com/eclipse-sumo/sumo/blob/main/build_config/docker/Dockerfile.ubuntu.git" \
      org.opencontainers.image.documentation="https://sumo.dlr.de/docs/Developer/Docker.html" \
      org.opencontainers.image.licenses="EPL-2.0 OR GPL-2.0-or-later"

# Setup environment
ENV SUMO_HOME=/usr/share/sumo
ARG DEBIAN_FRONTEND=noninteractive
ARG ARROW_VERSION=2100

# Getting build artifacts
COPY --from=build /install/usr /usr
# Get dependency lists
COPY --from=build /opt/sumo/build_config/build_req_deb.txt /tmp/build_req_deb.txt
COPY --from=build /opt/sumo/build_config/tools_req_deb.txt /tmp/tools_req_deb.txt
COPY --from=build /opt/sumo/tools/requirements.txt /tmp/requirements.txt

# Installing runtime dependencies (for simplicity we use the build dependencies. Possibility for optimization in the future)
RUN apt-get -qq update && \
    apt-get -y install git ca-certificates lsb-release wget && \
    wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get -y install ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
    apt-get -qq update && \
    apt-get -y install libarrow-dev libparquet-dev && \
    apt-get -qq -y install $(cat /tmp/build_req_deb.txt) $(cat /tmp/tools_req_deb.txt) \
                           libavformat58 libopenscenegraph161 libswscale5 libarrow$ARROW_VERSION libparquet$ARROW_VERSION && \
    apt-get -qq clean autoclean && \
    apt-get -qq -y autoremove && \
    rm -rf /var/lib/apt/lists/*

# Installing tools dependencies for python
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt

CMD ["/bin/bash", "-c"]