Is anyone `pants publish`ing Docker images on GitL...
# general
f
Is anyone `pants publish`ing Docker images on GitLab CI? This requires Docker-in-Docker AFAIK, but the official
docker:X.Y.Z-cli
images are Alpine based which pants does not support. There are several threads on the topic here, but none with conclusive guidance for how to go about this. An example
gitlab-ci.yaml
would be super helpful, as would any general guidance.
1
Long story short I’m trying to deploy an Azure Function app via container. While zip-deploying PEXes has worked in the past, I’ve encountered some incompatibility with PEXes produced starting around Pants 2.20 (search for my previous thread on the topic).
b
Sorry for the trouble, seems like this has been a bit of a saga for you. Is https://pantsbuild.slack.com/archives/C046T6T9U/p1733484343664749 relevant? (Unfortunately I don’t know anything about Gitlab myself so cannot help with the specifics)
f
Definitely has been a saga 😅. Building our own Docker image or using our runners is an option, but it’d be great to avoid the extra complexity if possible. I’d love to figure out what, if anything, changed about the PEX formulation between 2.19 and 2.20 that caused our Functions to break, though I’m out of my depth there. I’m optimistic the flatter package of the
python_aws_lambda_function
target will resolve the issue. I initially got PEXes working in Azure Function App land by adding the following block between Python standard library imports and first+third party imports and I wonder if this kludge is also somehow implicated in the current issues I’m facing 🤷
Copy code
try:
    import __pex__  # type: ignore # noqa # pants: no-infer-dep
except ModuleNotFoundError:
    pass
👍 1
Thanks for the help btw. I’ll keep this thread updated.
Promising early results… I used
python_aws_lambda_function
to package the test Function I linked in the other thread and it works! This could be it! The
handler
field is symbolic, but I can use
dependencies
to include all the Functions (must be in separate directories per Azure’s requirements 🙃)
e
I've had some success using
cruizba/ubuntu-dind:noble-27.1.1
as pretty much a drop in replacement for the regular alpine dind image
👍 1
f
Thanks, I was looking around for such an image but had trouble digging it up. So far it looks like I can avoid needing dind using the
python_aws_lambda_function
target, but if it doesn’t pan out I’ll give it a a shot.
e
good luck!
🤞 1
c
Is anyone pants publishing Docker images on GitLab CI?
Yes! But we are hosting our own runners so dind isn't an issue for us. If I'm misreading and the other pointers don't help let me know
f
I’m good to go. Huon’s suggestion allowed me to avoid the need for building pex-in-docker to deploy to Azure Functions 🎉
👍 1