acceptable-action-74245
06/20/2024, 5:16 PMDockerImageAsset
construct it exposes expects a Dockerfile
, and tries to actually build it. By the time I'm deploying, pants will have already built my image including x-platform support and embedding a pex file, so I don't want to redo the build using AWS's build tooling.
The alternative option is to provide it with a TarballImageAsset
, which would work on the output of a command like docker save my-pants-built-image:latest -o my-pants-built-image.tar
. I'd like to get this to work, but I'm trying to figure out the most idiomatic way to get from an image packaged via my docker_image
pants target to this tar. Does anyone have suggestions? I'm pretty brand new to the pants ecosystem, so apologies if I mangle any terminologyacceptable-action-74245
06/20/2024, 6:15 PMrun_shell_command
to run docker save ...
, and put the file in my dist directory manuallycold-jackal-89755
06/20/2024, 8:23 PMcold-jackal-89755
06/21/2024, 7:23 PMdocker_image
and then use pants publish to push the image to ecr. In cdk we use the DockerImageFunction
construct and for code you pass in DockerImageCode.from_ecr(repo)
acceptable-action-74245
06/21/2024, 8:01 PMdocker_image(
name="my_img",
)
run_shell_command(
name="my_img_tar_export",
command="mkdir -p dist && docker save my_img:latest -o dist/my_img.tar",
execution_dependencies=[":my_img"],
)
acceptable-action-74245
06/21/2024, 8:02 PMTarballImageAsset
pointing to full/path/to/this/pants/BUILD/dist/my_img.tar
cold-jackal-89755
06/21/2024, 8:08 PMacceptable-action-74245
06/21/2024, 8:10 PMdocker_image
one) that would get the package
goal to handle saving the tar and putting it in the main distacceptable-action-74245
06/21/2024, 8:12 PMdist/
2. Run typescript+react build toolchain and put artifacts in webdist/
3. Run CDK deploy, which should be able to work only off of those two directories