`docker_image` doesn't build specified platform
garysassano opened this issue ยท 0 comments
garysassano commented
Community Note
- Please vote on this issue by adding a ๐ reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform (and docker Provider) Version
cdktf v0.20.1
kreuzwerker/docker v3.0.2
Affected Resource(s)
docker_image
Terraform Configuration Files
main.ts
const backImage = new Image(this, "BackImage", {
buildAttribute: {
context: path.join(__dirname, "back"),
platform: "linux/arm64",
},
name: `${backRepo.repositoryUrl}:latest`,
triggers: { filesha256: backDockerfileDigest },
});
Dockerfile
FROM public.ecr.aws/docker/library/node:20-slim
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.1 /lambda-adapter /opt/extensions/lambda-adapter
ENV AWS_LWA_PORT=4000
WORKDIR /var/task
ADD . /var/task
RUN yarn install && yarn build
EXPOSE 4000
CMD [ "yarn", "run", "start" ]
Debug Output
Panic Output
Expected Behaviour
Actual Behaviour
I deploy the image to a containerized Lambda function with arm64
architecture and it doesn't work. Switching to x86_x64
architecture works. In fact, if I run the built image locally, it works (I use Ubuntu 22.04.3 LTS on WSL2 with x86_x64
architecture).
It's not clear to me if this Terraform provider uses BuildKit to create a multi-platform image. If so, I guess it should accept TARGETPLATFORM
as an ARG
.
Steps to Reproduce
terraform apply
Important Factoids
References
- #0000