full-nightfall-13189
01/16/2025, 8:22 PMFROM <http://gcr.io/distroless/python3-debian12@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160|gcr.io/distroless/python3-debian12@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160> AS runtime
in a multi-stage build, but pants errors out with:
❯ pants --docker-build-verbose package src/docker/repr
15:18:55.89 [INFO] Completed: Building docker image repr:test
15:18:55.89 [INFO] Completed: Building docker image repr:latest
15:18:55.89 [INFO] Completed: Building docker image repr:debug
15:19:32.62 [INFO] Canceled: Building docker image repr:debug
15:19:32.63 [ERROR] 1 Exception encountered:
Engine traceback:
in `package` goal
DockerBuildTargetStageError: The 'target_stage' field in `docker_image` src/docker/repr:runtime was set to 'runtime', but there is no such stage in `src/docker/repr/Dockerfile`. Available stages: builder, debug, smoke_tests, upstream_debug.
❯
Any idea why this might be?broad-processor-92400
01/16/2025, 9:50 PMsrc/docker/repr/Dockerfile
(or at least the FROM
lines of that file)?full-nightfall-13189
01/16/2025, 10:47 PM❯ grep FROM src/docker/u21repr/Dockerfile
FROM golang:1.23-bookworm AS builder
FROM <http://gcr.io/distroless/python3-debian12@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160|gcr.io/distroless/python3-debian12@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160> AS runtime
FROM <http://gcr.io/distroless/python3-debian12:debug|gcr.io/distroless/python3-debian12:debug> AS upstream_debug
FROM runtime AS debug
FROM debug AS smoke_tests
❯
broad-processor-92400
01/16/2025, 10:51 PMruntime
name is special-cased for some reason: can you try just changing it to something else temporarily?
2. The @sha256:...
reference is handled differently to the :<tag>
references: can you try switch it to :debug
or something temporarily?full-nightfall-13189
01/17/2025, 1:40 AMruntime
to foobar
in both the pants BUILD and Dockerfile results in the same error message (ofc foobar
stage is now not found instead of runtime
)
2. Switching FROM <http://gcr.io/distroless/python3-debian12@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160|gcr.io/distroless/python3-debian12@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160> AS runtime
to a tag works fine.broad-processor-92400
01/17/2025, 1:41 AMbroad-processor-92400
01/17/2025, 1:43 AMFROM .../python3-debian12:latest@sha256:...
(i have a vague memory that this is valid syntax and might be enough to 'trick' pants, while still using the pinned hash?)full-nightfall-13189
01/17/2025, 1:43 AMfull-nightfall-13189
01/17/2025, 1:44 AMbroad-processor-92400
01/17/2025, 1:45 AMdocker pull <http://gcr.io/distroless/python3-debian12:totally_made_up_not_a_real_tag@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160|gcr.io/distroless/python3-debian12:totally_made_up_not_a_real_tag@sha256:8e432c787b5c0697dfbfd783120351d90fd5f23ba9fff29532bbdbb87bc13160>
and that worked finefull-nightfall-13189
01/17/2025, 1:46 AMbroad-processor-92400
01/17/2025, 1:47 AMStage 2 ...
), but not yet obvious to me why, so definitely file a bug and we can see about changing that:
https://github.com/pantsbuild/pants/blob/48f4713bdd2d820af82102bd95d3ff492a2b1b92/src/rust/engine/dep_inference/src/dockerfile/tests.rs#L83-L103full-nightfall-13189
01/17/2025, 2:18 PMfull-nightfall-13189
01/17/2025, 2:18 PM