icy-hair-30586
03/15/2022, 8:22 AMrequirements=["x==1.0.1"],
, and i would like to build a docker image with FROM x-1.0.1-py3.8
. I’ve figured out how to do it through docker build args, but that involves a pants peek
and some command line wrangling. Any recommendations for a simpler way to do it?curved-television-6568
03/15/2022, 8:35 AMstrong-toothbrush-37759
03/15/2022, 9:04 AMicy-hair-30586
03/15/2022, 9:37 AM3rdparty/python/build
contains
python_requirement(
name="prefect",
requirements=["prefect==1.1.0"],
)
Dockerfile now contains
ARG PREFECT_VERSION=1.1.0
FROM prefecthq/prefect:${PREFECT_VERSION}-python3.8
and the CI pipeline does something like
PREFECT_VERSION=$(./pants peek 3rdparty/python:prefect | jq '.[0].requirements[0]' | tr -d '"' | sed -e 's/prefect==//')
...
./pants package src/docker:hello --docker-build-args="['PREFECT_VERSION=$(PREFECT_VERSION)']"
This works fine in CI, but locally it could happen that the dev forgets to update the default PREFECT_VERSION in the dockerfile ending up with weirdness when running the locally built imagestrong-toothbrush-37759
03/15/2022, 9:42 AMicy-hair-30586
03/15/2022, 10:06 AMcurved-television-6568
03/15/2022, 10:07 AM.ci-vars.sh
script that sets up the environemnt, then source that from the ./pants
bootstrap script. That way, you can have the pants peek operation run also for the devs without them having to worry about it.