From e3526637ebabe85d3b9a0910a27c3c138076a266 Mon Sep 17 00:00:00 2001 From: Radovan Zivkovic Date: Wed, 10 Jul 2024 12:42:22 +0200 Subject: [PATCH] Set POETRY_VERSION as build argument in Dockerfile --- Dockerfile | 4 +++- Makefile | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a9d38afe..4b3cb2e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,8 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 100 \ FROM base AS python_builder +ARG POETRY_VERSION=1.8.2 + # hadolint ignore=DL3008 RUN apt-get update -qq \ && apt-get install -y --no-install-recommends \ @@ -26,7 +28,7 @@ RUN apt-get update -qq \ # install poetry # keep this in sync with the version in pyproject.toml and Dockerfile -ENV POETRY_VERSION=1.8.2 +ENV POETRY_VERSION=$POETRY_VERSION SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN curl -sSL https://install.python-poetry.org | python ENV PATH="/root/.local/bin:/opt/venv/bin:${PATH}" diff --git a/Makefile b/Makefile index 57daad49..22e970ca 100644 --- a/Makefile +++ b/Makefile @@ -41,9 +41,11 @@ lint-docstrings: ## check docstrings IMAGE_NAME ?= rasa/rasa-sdk IMAGE_TAG ?= latest PLATFORM ?= linux/arm64 +POETRY_VERSION ?= $(shell ./scripts/poetry-version.sh) build-docker: ## build docker image for one platform docker build . \ + --build-arg POETRY_VERSION=$(POETRY_VERSION) \ --platform=$(PLATFORM) \ -f Dockerfile \ -t $(IMAGE_NAME):$(IMAGE_TAG) @@ -53,7 +55,8 @@ build-docker: ## build docker image for one platform build-and-push-multi-platform-docker: PLATFORM = linux/amd64,linux/arm64 build-and-push-multi-platform-docker: ## build and push multi-platform docker image docker buildx build . \ - --platform=$(PLATFORM) \ + --build-arg POETRY_VERSION=$(POETRY_VERSION) \ + --platform=$(PLATFORM) \ -f Dockerfile \ -t $(IMAGE_NAME):$(IMAGE_TAG) \ --push