Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying existing docker image #196

Closed
2 tasks
timdinhdotcom opened this issue Dec 4, 2021 · 3 comments
Closed
2 tasks

Deploying existing docker image #196

timdinhdotcom opened this issue Dec 4, 2021 · 3 comments
Labels
duplicate This issue is a duplicate. feature-request A feature should be added or improved. module/cli-ext needs-review p2 This is a standard priority issue

Comments

@timdinhdotcom
Copy link

If I ran the command below, it will build a docker image then push it to ECR and perform other steps.

dotnet lambda deploy-serverless --stack-name my-app

I have a project which I must use docker buildx build . command to create a docker image. Is there a way to tell deploy-serverless to use existing image instead?

Describe the Feature

Allow user to specify an existing image when deploying lambda serverless with the command dotnet lambda deploy-serverless command.

Maybe add a parameter called --use-image?

Is your Feature Request related to a problem?

Proposed Solution

I have a project which I must use docker buildx build . command to create a docker image. There is no way to deploy this image with dotnet lambda deploy-serverless command

Describe alternatives you've considered

Maybe manually deploy the image to ECR then manually changing the Lambda configuration to use the new image?

Additional Context

I have an Apple M1 MacBook and trying to deploy an x64 image.
The command dotnet lambda deploy-serverless only create image for arm64 architecture. I need an x64 image so I have to use docker buildx build command to create an x64 image.

Environment

Developer environment is Apple M1 MacBook (arm64 architecture)

Target environment is AWS serverless (x64 architecture). AWS do offer arm64 lambda serverless too but one of the project had native dependency on x64 and is it not possible to run it on arm64.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@timdinhdotcom timdinhdotcom added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 4, 2021
@ashishdhingra
Copy link
Contributor

When deploying the serverless application using Image package type, serverless.template has AspNetCoreFunction resource with ImageUri as one of the properties. For example:

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Transform": "AWS::Serverless-2016-10-31",
  "Description": "An AWS Serverless Application that uses the ASP.NET Core framework running in Amazon Lambda.",
  "Parameters": {},
  "Conditions": {},
  "Resources": {
    "AspNetCoreFunction": {
      "Type": "AWS::Serverless::Function",
      "Properties": {
        "PackageType": "Image",
        "ImageConfig": {
          "EntryPoint": [
            "/lambda-entrypoint.sh"
          ],
          "Command": [
            "AWSServerlessNET5::AWSServerlessNET5.LambdaEntryPoint::FunctionHandlerAsync"
          ]
        },
        "ImageUri": "",
        "MemorySize": 256,
        "Timeout": 30,
        "Role": null,
        "Policies": [
          "AWSLambda_FullAccess"
        ],
        "Events": {
          "ProxyResource": {
            "Type": "Api",
            "Properties": {
              "Path": "/{proxy+}",
              "Method": "ANY"
            }
          },
          "RootResource": {
            "Type": "Api",
            "Properties": {
              "Path": "/",
              "Method": "ANY"
            }
          }
        }
      },
      "Metadata": {
        "Dockerfile": "Dockerfile",
        "DockerContext": ".",
        "DockerTag": ""
      }
    }
  },
  "Outputs": {
    "ApiURL": {
      "Description": "API endpoint URL for Prod environment",
      "Value": {
        "Fn::Sub": "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
      }
    }
  }
}

Not sure if setting ImageUri property would provide workaround for user. Needs review with the team.

@ashishdhingra ashishdhingra added needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Jan 28, 2022
@ashishdhingra ashishdhingra added the p2 This is a standard priority issue label Dec 14, 2022
@ashishdhingra ashishdhingra added the duplicate This issue is a duplicate. label Mar 16, 2023
@ashishdhingra
Copy link
Contributor

This is being tracked as part of issue #264. The ImageUri used to work in version 4.3.0 of Amazon.Lambda.Tools, but not working in latest version.

Also take note of findings in #264 (comment). Per https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-imageuri, Building your application with necessary Metadata entries takes precedence over ImageUri, so if you specify both then ImageUri is ignored.. So ImageUri scenario kicks in if Metadata is not present.

@ashishdhingra ashishdhingra closed this as not planned Won't fix, can't repro, duplicate, stale Mar 16, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue is a duplicate. feature-request A feature should be added or improved. module/cli-ext needs-review p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants