@ -1,13 +1,34 @@
FROM python:3.10 as base
ARG base_image = python
ENV TOBIKO_DIR = /tobiko
ENV WHEEL_DIR = /wheel
FROM python:3.10 as python
ENV INSTALL_PACKAGES = "apt install -y"
ENV CONSTRAINS_FILE = upper-constraints.txt
RUN apt update && apt install -y iperf3 iputils-ping ncat
FROM python:3.8 as lower-constraints
ENV INSTALL_PACKAGES = "apt install -y"
ENV CONSTRAINS_FILE = lower-constraints.txt
RUN apt update && apt install -y iperf3 iputils-ping ncat
# Install binary dependencies
RUN apt update && \
${ INSTALL_PACKAGES } git
FROM fedora:35 as fedora
ENV CONSTRAINS_FILE = upper-constraints.txt
ENV INSTALL_PACKAGES = "dnf install -y"
RUN ${ INSTALL_PACKAGES } iperf3 gcc python3-devel
FROM ${base_image} as base
ENV TOBIKO_DIR = /tobiko
ENV WHEEL_DIR = /wheel
RUN python3 -m ensurepip --upgrade && \
python3 -m pip install --upgrade setuptools wheel
@ -15,8 +36,8 @@ RUN python3 -m ensurepip --upgrade && \
FROM base as source
# Populate tobiko source dir
# RUN mkdir -p ${TOBIKO_DIR}
# Install binary dependencies
RUN ${ INSTALL_PACKAGES } git
ADD .gitignore \
extra-requirements.txt \
@ -25,21 +46,18 @@ ADD .gitignore \
setup.cfg \
setup.py \
test-requirements.txt \
upper-constraints.txt \
${ CONSTRAINS_FILE } \
${ TOBIKO_DIR } /
ADD .git ${ TOBIKO_DIR } /.git/
ADD tobiko/ ${ TOBIKO_DIR } /tobiko/
ADD .git ${ TOBIKO_DIR } /.git/
FROM source as build
# Install binary dependencies
# RUN ${INSTALL_PACKAGES} gcc python3-devel
# Build wheel files
RUN python3 -m pip wheel -w ${ WHEEL_DIR } \
-c ${ TOBIKO_DIR } /upper-constraints.txt \
-c ${ TOBIKO_DIR } /${ CONSTRAINS_FILE } \
-r ${ TOBIKO_DIR } /requirements.txt \
-r ${ TOBIKO_DIR } /test-requirements.txt \
-r ${ TOBIKO_DIR } /extra-requirements.txt \
@ -56,9 +74,6 @@ RUN python3 -m pip install ${WHEEL_DIR}/*.whl
FROM source as tobiko
# Install packages
RUN ${ INSTALL_PACKAGES } iperf3 iputils-ping ncat
# Run tests variables
ENV PYTHONWARNINGS = ignore::Warning
ENV OS_TEST_PATH = ${ TOBIKO_DIR } /tobiko/tests/unit
@ -70,11 +85,27 @@ ENV TOBIKO_PREVENT_CREATE=false
RUN mkdir -p /etc/tobiko
RUN printf " [DEFAULT]\nlog_dir= ${ TOBIKO_REPORT_DIR } " > /etc/tobiko/tobiko.conf
# Copy python pacakges
COPY --from= install /usr/local /usr/local/
# Copy tobiko tools
ADD tools/ ${ TOBIKO_DIR } /tools/
# Copy python pacakges
COPY --from= install /usr/local /usr/local/
WORKDIR ${TOBIKO_DIR}
CMD tools/run_tests.py ${ OS_TEST_PATH }
FROM tobiko as linters
ENV SKIP = check-executables-have-shebangs,pylint
# Copy configuration files
ADD .pre-commit-config.yaml \
linters-requirements.txt \
${ TOBIKO_DIR } /
RUN python3 -m pip install -r ${ TOBIKO_DIR } /linters-requirements.txt
RUN pre-commit install --install-hooks
WORKDIR ${TOBIKO_DIR}
CMD pre-commit run -a