What is the difference between PackageType: Image and build --use-container in a SAM App?
Asked Answered
S

1

6

PackageType: image seems to require a Dockerfile (looking at the hello-world example) along with ImageUri and Metadata And it also doesn't want me to use Runtime, Handler, Layers (not even using layers)

whereas build --use-container does not seem to need anything. Does it figure it all out from the Runtime: nodejs14.x-v1

In the documentation I don't see anything

When I google there are tons of docs and resources but none related

I would really like to know because I'm at building a pipeline stage now. I got it to work great with a single stage and would now like to use the multi-stage multi-account and from what I read, it is recommended to use Images.

I noticed that the current pipeline does have --use-container, but my PackageType is zip, and at some point when I built it (using sam pipeline --bootstrap) it asked me if any of my functions use images. I would like for my multi stage/account one to answer Y

It may not be related, but that is also how I plan on using environment variables for each account, since the databases used to fetch data are different. So I think I'll have to go and add --container-env-var-file in the gitlab-ci.yml script, or maybe in the samconfig.toml [dev.build.parameters] and under [prod.build.parameters]for itsenv-prod.json` file

Salina answered 7/6, 2022 at 23:26 Comment(0)
E
1

SAM application package types can be either Zip or Images (container images). The details of their differences are described in their docs here: https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html

I came across that page 👆 when I was reading the AWS docs for auto-creating a new SAM app here: https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/serverless-apps.html#serverless-apps-create

(when you need to: "Choose the runtime for your AWS SAM application")

Elroyels answered 28/11, 2022 at 5:38 Comment(1)
Both link are no more talking about what we expects and / or doesn't exists. This is why S.O. discourages link-only answers. I have the same question and there is no more a valid answer hereFives

© 2022 - 2024 — McMap. All rights reserved.