https://pulumi.com logo
Title
m

mysterious-family-43099

05/01/2023, 6:40 PM
I was able to get it working with the pulumi docker package as such:
const image = new docker.Image(`${stackName}-image`, {
        build: {
          cacheFrom: {
              images: [pulumi.interpolate`${repo.repositoryUrl}:latest`],
          },
          context: `../../../${project}`,
          ...(dockerfileName && {
            dockerfile: `../../../${project}/${dockerfileName}`,
          }),
          args: dockerArgs,
          platform: "linux/amd64",
        },
        imageName: pulumi.interpolate`${repo.repositoryUrl}:latest`,
        registry: {
            password: pulumi.secret(authToken.password),
            server: repo.repositoryUrl,
            username: authToken.userName,
        },
    });

    return image.repoDigest as pulumi.Output<string>;
g

gifted-barista-41153

05/01/2023, 9:36 PM
Weird, I’m doing the same thing (cacheFrom an ECR image). I can see that it is pulling the image, but it doesn’t seem to actually do anything with it. The docker build still installs npm packages, etc - no cached layers are used. Does it cache anything for you?
t

thousands-pizza-93362

05/02/2023, 3:12 AM
Yeah. So when I was using awsx and ecr to call buildAndPush, it was doing that. When I switched to using the pulumi docker library explicitly as you see in the example above, it worked. Works in the GitHub action too @gifted-barista-41153