From c1c04ec4efc1f655423f3dabff196c79624819d7 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Thu, 21 Apr 2022 17:08:23 -0400 Subject: [PATCH] Add Dockerfile for creating sdists --- Dockerfile.dist | 42 ++++++++++++++++++++++++++++++++++++++++++ install.sh | 5 ++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.dist diff --git a/Dockerfile.dist b/Dockerfile.dist new file mode 100644 index 0000000..4de18ff --- /dev/null +++ b/Dockerfile.dist @@ -0,0 +1,42 @@ +# Copyright 2022 Mycroft AI Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# ----------------------------------------------------------------------------- +# Dockerfile for Mimic 3 (https://github.com/MycroftAI/mimic3) +# +# Runs code checks and creates source code distributions for PyPI. +# +# Requires Docker buildx: https://docs.docker.com/buildx/working-with-buildx/ +# ----------------------------------------------------------------------------- +FROM python:3.9 + +ARG TARGETARCH +ARG TARGETVARIANT + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +WORKDIR /build/mimic3 +COPY ./ ./ + +# Install mimic3 and development dependencies +RUN --mount=type=cache,id=pip-venv,target=/root/.cache/pip \ + ./install.sh develop + +# Check code +RUN ./check.sh + +# Create sdists +RUN ./build-dist.sh diff --git a/install.sh b/install.sh index c23a54a..d03fed3 100755 --- a/install.sh +++ b/install.sh @@ -19,6 +19,9 @@ # Creates a virtual environment and installs local Python modules in editable # mode (-e). # +# Development dependencies (linters, etc.) will be installed if 'develop' is +# given as an argument. +# set -eo pipefail # Directory of *this* script @@ -56,7 +59,7 @@ popd 2>/dev/null pip3 ${PIP_INSTALL} -e "${this_dir}/mimic3-http" -if [ -f "${this_dir}/requirements_dev.txt" ]; then +if [ "$1" = 'develop' ]; then pip3 ${PIP_INSTALL} -r "${this_dir}/requirements_dev.txt" fi