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

[sam build/Feature] Turn off use of temp directory, allow to build in current folder #2655

Closed
mribichich opened this issue Feb 24, 2021 · 8 comments
Labels
area/build sam build command maintainer/need-followup stage/pm-review Waiting for review by our Product Manager, please don't work on this yet type/feature Feature request

Comments

@mribichich
Copy link

mribichich commented Feb 24, 2021

Have a flag to turn off the use of the temp directory when building. Basically the idea is to be able to use the current src path.

The temp directory doesnt work for situations like nodejs monorepos or common dependencies between projects.

Since once on folder is copied to this temp folder, it will loose all context.

So, ideally it would be to run the build in the same src folder.

For example, for people using webpack, coping everything to a temp dir, installing, etc, is a waste of time.

My case:

We have a nodejs monorepo project with 20 lambdas. obviously we cant use common dependencies just like that, because of this temp dir. We also use webpack, so doing all of that is a waste of time.

we dont need sam build to copy and install for us.

one normally would run yarn or npm install on its own at the beginning.

And then we need a way to tell sam build what to copy to the artifacts dir. Using gitignore or npmignore is not appropriately here.

It would be awesome to have a samconfig that we could say what to include or exclude, maybe as a way of overriding defaults.

thanks

this feature would fix issues like these and probably others:

#2064
#2077

@hawflau hawflau added stage/pm-review Waiting for review by our Product Manager, please don't work on this yet type/feature Feature request area/build sam build command labels Feb 24, 2021
@pwinnski
Copy link

I think this might also solve some issues with sam and multi-module maven projects.

@spiceddest
Copy link

I just figured out that it's using a temp folder, and it also copies all the node_modules folder for each (!) function.
I have 30 functions in my project, so this really slows down the build step.

@ssenchenko
Copy link
Contributor

We have a roadmap here, and we also try to take in popular feature requests based on 👍🏽 from the community. You can check the roadmap to see if your proposal has been prioritized for implementation.

@salvianreynaldi
Copy link

salvianreynaldi commented Jun 8, 2022

hope this feature is added soon 😄

Here are my reasons:

  1. To build a linux/arm64 GraalVM native-image binary with Quarkus + Gradle on MacBook Pro with Apple Silicon, I need to use a container (from quarkus side, not SAM). However, Rancher Desktop (since Docker Desktop is now not free to use) doesn't mount the SAM temp directory by default.
  2. I usually include gradle dependency lock files, which are generated during gradle builds, to the version control. Since sam builds in the temp directory, I couldn't know which dependency versions are used as there are no persistent lock files.

@nweajoseph
Copy link

without this SAM is almost unusable in node lambdas

@ceberz
Copy link

ceberz commented Jun 10, 2022

Our SAM project uses Typescript, and while the custom build feature has made Typescript compilation possible, having the option for an in-place build rather than copying would alleviate several pain points for us:

  • The time to copy the root directory can be pretty long if your project uses a traditional node_modules directory
  • Any local dependencies that exist above the directory where the Makefile lives become a problem

@torresxb1
Copy link
Contributor

Closing so that we can track in the above issue (Feature request: Build in source). There's multiple open issues relating to similar problems, so we want to have a central place to track.

@github-actions
Copy link
Contributor

⚠️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
area/build sam build command maintainer/need-followup stage/pm-review Waiting for review by our Product Manager, please don't work on this yet type/feature Feature request
Projects
None yet
Development

No branches or pull requests

10 participants