1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2022 University of New Hampshire 3 4# There are two Docker images defined in this Dockerfile. 5# One is to be used in CI for automated testing. 6# The other provides a DTS development environment, simplifying Python dependency management. 7 8FROM ubuntu:22.04 AS base 9 10RUN apt-get -y update && apt-get -y upgrade && \ 11 apt-get -y install --no-install-recommends \ 12 python3 \ 13 python3-pip \ 14 pipx \ 15 python3-cachecontrol \ 16 git \ 17 xz-utils \ 18 openssh-client && \ 19 pipx install poetry>=1.8.2 && pipx ensurepath && \ 20 git config --global --add safe.directory /dpdk 21WORKDIR /dpdk/dts 22 23 24FROM base AS runner 25 26# This image is intended to be used as the base for automated systems. 27# It bakes DTS into the image during the build. 28 29COPY . /dpdk/dts 30# pipx installs packages in ~/.local/bin, which is not in PATH by default. The `pipx ensurepath` 31# command used in the previous step adds said directory to PATH, but the docker build process does 32# not preserve environment variables between steps. Therefore, ~/.local/bin must be manually added 33# into PATH in order to use the poetry command below. 34ENV PATH="$PATH:/root/.local/bin" 35RUN poetry install --only main 36 37ENTRYPOINT ["poetry", "run", "python", "main.py"] 38 39FROM base AS dev 40 41# This image is intended to be used as DTS development environment. It doesn't need C compilation 42# capabilities, only Python dependencies. Once a container mounting DTS using this image is running, 43# the dependencies should be installed using Poetry. 44 45RUN apt-get -y install --no-install-recommends \ 46 vim emacs 47