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

QUESTION: build once run anywhere possible with serverless-webpack? #558

Closed
ed4becky opened this issue Feb 24, 2020 · 10 comments · Fixed by #560
Closed

QUESTION: build once run anywhere possible with serverless-webpack? #558

ed4becky opened this issue Feb 24, 2020 · 10 comments · Fixed by #560
Assignees
Labels
Milestone

Comments

@ed4becky
Copy link

We currently have 5 environments we deploy our lambda functions to (dev, test, uat, stage, prod)

in our CI/CD pipeline we call sls deploy for each one, triggering a webpack build each time.

Is it possible with serverless-webpack to build the functions once, and deploy the single build to each environment? I know some configuration files get built with stage specific names (roles, the arn for each function, others...), but is that a separate part of the process from the webpack build? Or doe the webpack step include stage specific output?

Can I run the package thru webpack once, and include the results in the packaging for each stage?

@sakthi-ganesh
Copy link

Any update on this? Currently "serverless deploy" command is triggering a compile, but i would need to refer the already compiled code in "output" folder during deployment. Please suggest

@miguel-a-calles-mba
Copy link
Member

This PR might be what you are seeking.

#560

You can install the PR for now; that what I am doing.

@miguel-a-calles-mba miguel-a-calles-mba linked a pull request Apr 22, 2020 that will close this issue
7 tasks
@miguel-a-calles-mba miguel-a-calles-mba added this to the 5.3.3 milestone Apr 22, 2020
@miguel-a-calles-mba miguel-a-calles-mba self-assigned this Apr 22, 2020
@miguel-a-calles-mba
Copy link
Member

miguel-a-calles-mba commented Apr 22, 2020

Here's how I do it.

  1. Run sls webpack
  2. Zip (or tgz) the .serverless directory and include it as part of the artifacts.
  3. Extract the zip package right before deploy time.
  4. Deploy sls deploy --no-build to reuse the extracted .serverless directory.

@sakthi-ganesh
Copy link

sakthi-ganesh commented Apr 22, 2020

Thanks Miguel!

But sill the --no-build is doing the build before deploy. I configured my package.json with the below 2 scripts

"build": "serverless webpack",
"deploy": "serverless deploy --no-build"

And i give the below commands

npm run build -> For building the code
npm run deploy -> For deploying the code

Please let me know if i am missing any item here

@miguel-a-calles-mba
Copy link
Member

Try npm i github:serverless-heaven/serverless-webpack#pull/560/head to install the PR.

@miguel-a-calles-mba
Copy link
Member

This PR is tentatively planned for release 5.3.3

@sakthi-ganesh
Copy link

Thanks Miguel!. It works great and as expected.. Please release 5.3.3 at the earliest.. Eagerly waiting to see it in npm repository.

@miguel-a-calles-mba
Copy link
Member

I'm eagerly waiting for this PR too! We need to release 5.3.2 first. =)

@sakthi-ganesh
Copy link

Hi Miguel,

Could you please tell me if any release dates planned for 5.3.2 and 5.3.3?

@miguel-a-calles-mba
Copy link
Member

Hi @sakthi-ganesh , 5.3.2 should go out soon. Just waiting for approval of the release PR.

#582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants