# Build Debian package using dh-virtualenv
#
# To create a package for Stretch in `dist/`, call:
#
#   ./build.sh debian:stretch

# Build arguments, as provided by 'build.sh'
ARG DIST_ID="debian"
ARG CODENAME="stretch"
ARG PKGNAME

## Start package builder image for the chosen platform
FROM ${DIST_ID}:${CODENAME} AS dpkg-build

# Pass build args into image scope
ARG CODENAME
ARG PKGNAME
ARG VERSION

# Install build tools and package build deps including nodejs
RUN env LANG=C apt-get update -qq -o Acquire::Languages=none \
    && env LANG=C DEBIAN_FRONTEND=noninteractive apt-get install \
        -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \
        \
        apt-transport-https \
        apt-utils \
        build-essential \
        debhelper \
        devscripts \
        equivs \
        gnupg2 \
        gzip \
        libparse-debianchangelog-perl \
        lintian \
        lsb-release \
        python3-all \
        python3-dev \
        python3-pip \
        python3-pkg-resources \
        python3-setuptools \
        tar \
        libxml2-dev

RUN pip3 install pytest

WORKDIR /dpkg-build
COPY ./ ./
RUN dpkg-buildpackage -tc
