appleboy / lambda-action

GitHub Action for Deploying Lambda code to an existing function

Home Page:https://github.com/marketplace/actions/aws-lambda-deploy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does this Action update the python environment from requirements.txt?

jgwinner opened this issue · comments

Hello:

The best of the Lambda's updaters, the only one I've seen that request python version.

A question though - will this install a virtual environment from requirements.txt and upload that inside the .zip file?

It wasn't clear from the docs.

Ah, after running it, it looks like although the key python3.6 can be loaded, it's really just uploading whatever .zip file is in the artifact, not making it, itself.

commented

@jgwinner what are you using then to process the requirements?

I basically took a shell script we used before to do the deploy, and hacked it up to work inside the runner.

This was more work than it sounds like. It took me a while to find out the location of "site packages".

          run: python -m venv venv && source venv/bin/activate &&
              pip3 install -r requirements.txt

        # activate the venv
        - name: Activate venv 
          run: . venv/bin/activate 
          # TODO would run tests here; 
          ## create zipfile


        # add our venv / dependencies to the zip
        - name: Add Dependencies to Zip file
          run: |
            mkdir -v to_deploy
            find . -name "*.py" -maxdepth 1 -exec cp {} to_deploy \;
            ls -l to_deploy
            cp -r ./venv/lib/python3.8/site-packages/* to_deploy

I don't know if this is the 'right' way, but it worked.

    == John ==

Oh - we also updated to 3.8 instead of 3.6 (whew)