question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow specifying docker container in which to build code

See original GitHub issue

Describe your idea/feature/enhancement

Sometimes with Python code one requires compiling packages that rely on C libraries. For example, trying to install mysqlclient in the default container will result in an error.

A way to overcome this issue, is to create a new Docker image, based on the lambci/lambda:build-python2.7 one, that will have mysql-devel and python-devel installed in it, and use it when running sam build -u.

Proposal

An obvious solution is just to provide an optional flag, e.g.

sam build --use-container --docker-image lambci/lambda:my-awesome-image

Additional Details

I don’t know enough about the SAM CLI infra to say, but if possible, it would be even better if one could provide a Dockerfile in the template.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:13
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jfusscommented, May 15, 2020

@prcongithub You could build the image locally, retag it as the image we download, and then pass --skip-pull-image.

1reaction
zoellnercommented, Feb 24, 2021

@simlu no, I’m still building things with the old containers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow specifying docker container in which to build code #1231
A way to overcome this issue, is to create a new Docker image, based on the lambci/lambda:build-python2.7 one, that will have mysql-devel and ......
Read more >
docker build - Docker Documentation
The docker build command builds Docker images from a Dockerfile and a “context”. A build's context is the set of files located in...
Read more >
Containerize an application - Docker Documentation
Start an app container · Start your container using the docker run command and specify the name of the image you just created:...
Read more >
Image-building best practices - Docker Documentation
When you have built an image, it is a good practice to scan it for security vulnerabilities using the docker scan command. Docker...
Read more >
Docker development best practices - Docker Documentation
Docker development best practices. The following development patterns have proven to be helpful for people building applications with Docker.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found