Is this impossible to write? Is this a bug? :image...
# general
a
Is this impossible to write? Is this a bug? :image is in /BUILD. I've tried :image /:image //:image
Copy code
ARG BASE=:image
FROM $BASE
1
🐛 1
c
Hi Sheena, You are likely to get a better response if you provide a little more detail about your setup, and what command you run and what the output is and what you expected. From what I can tell, this should work, as proven by tweaking this test case: https://github.com/pantsbuild/pants/blob/5bb87c7b88c3e008ced9c48d0b806f95bb96b6f0/[…]src/python/pants/backend/docker/util_rules/dependencies_test.py Where I put the BUILD and Dockerfile for the docker images at the project root, and the test still pass.
a
You are correct I should have. It seems to only happen within github actions so I'm struggling to replicate the issue or get any specific details that aren't so tied to my specific repo
So my base looks like this, oops hit enter too early:
Copy code
> cat release/python3/BUILD 
docker_image(
    name="python-base-3.11",
    source=None,
    repository="python-base-3.11",
    tags=["docker-base"],
    instructions=[
        "FROM python:3.11-slim",
	…
    ],
    skip_push=True,
)
And my downstream looks like this:
Copy code
ARG BASE=release/python3:python-base-3.11
FROM $BASE AS deps

COPY ... /binary.pex
RUN PEX_TOOLS=1 /usr/local/bin/python3.11 /binary.pex venv --scope=deps --compile /bin/app

FROM $BASE AS srcs
COPY ... /binary.pex
RUN PEX_TOOLS=1 /usr/local/bin/python3.11 /binary.pex venv --scope=srcs --compile /bin/app

FROM $BASE
ENTRYPOINT ["/bin/app/pex"]
COPY --from=deps /bin/app /bin/app
COPY --from=srcs /bin/app /bin/app
Works locally, just not in github actions.
chokes on FROM $BASE AS srcs
Copy code
failed to solve: python-base-3.11:latest: failed to resolve source metadata for <http://docker.io/library/python-base-3.11:latest|docker.io/library/python-base-3.11:latest>:
I'm even trying this:
Copy code
ARG BASE=release/python3:python-base-3.11
FROM $BASE AS base

...
FROM base AS srcs
...

...
FROM base
sorry for the spam. I'll try to replicate within the unit test you linked.
Looks like, locally, the last step of the base image is
Copy code
#9 naming to <http://docker.io/library/python-base-3.11:latest|docker.io/library/python-base-3.11:latest>
So that when my downstream dockerfile tries to resolve python-base-3.11:latest it just works. Github actions does NOT do this. I'm guessing it's because it's using the 'docker-container' driver. it does re-import but it does not properly name the base image to python-base-3.11 in order for the downstream to resolve it. I bet if i disabled buildx it would work in github actions... YUP. This looks like a difference between buildx 'docker-container' driver and 'default' driver that's triggering this behavior. I'll search for known bugs and file one if necessary.
👍 1
c
Thanks for reporting back your findings.