Giter Site home page Giter Site logo

amaysim-au / docker-serverless Goto Github PK

View Code? Open in Web Editor NEW
83.0 4.0 55.0 280 KB

Docker image containing NodeJS, Serverless Framework and Yarn.

License: MIT License

Makefile 65.84% Dockerfile 34.16%
docker-serverless serverless-framework nodejs docker-image yarn apigw

docker-serverless's Introduction

amaysim/serverless

npm deploy status image version docker pulls docker image size License

Serverless Application Framework AWS Lambda API Gateway

Docker image containing NodeJS, Serverless Framework and Yarn.

Usage

Docker run command

# running Serverless version 1.72.0
$ docker run --rm amaysim/serverless:1.72.0 serverless --help

Development

Prerequisites

  • Docker
  • Buildx
  • Make

Build image locally

# build image locally with latest Serverless version
$ make build

# build image locally with specific Serverless version
$ make build SERVERLESS_VERSION=1.72.0

# go inside the container
$ make shell

# testing multi arch build with buildx
# you may need to create a builder first
$ docker buildx create --name mybuilder --use
$ make buildMultiArch

# run the test
$ make ciTest

Docker image update automation

Periodically, once a week, a new amaysim/serverless Docker image containing the lastest version of Serverless is being built with GitHub Actions. This means that there is no need for someone to manually update and tag the image whenever there is a new Serverless version.

Contributing

The project follows the typical GitHub pull request model. Before starting any work, please either comment on an existing issue, or file a new one.

  1. Fork this repository
  2. Clone the forked repository
  3. Create a new branch with a meaningful name (optional)
  4. Make your changes
  5. Test locally (see section "Development")
  6. Commit and push your changes
  7. Create a pull request from a fork

Docker image

The Docker image has the following:

  • Node LTS (12.14.0) Alpine: we leverage Babel to be compatible with AWS Lambda runtime
  • Serverless Framework
  • yarn
  • zip: handy to zip your own serverless artifact
  • AWS CLI: required by some Serverless plug-ins to work

References

docker-serverless's People

Contributors

aarongorka avatar conormiley avatar ctompkinson avatar dependabot[bot] avatar egeland avatar flemay avatar gwagener avatar jonathanconway avatar jufemaiz avatar matt-wratt avatar nmeji avatar nosolopau avatar ypxing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-serverless's Issues

Feature request: support aws cli version 2

Describe the feature
Currently, amaysim/serverless only support aws cli v1, it would be great to have aws cli v1 supported.

The AWS CLI v2 offers several new features including improved installers, new configuration options such as AWS Single Sign-On (SSO), and various interactive features. More importantly, with serverless/serverless#9290, serverless framework still does not support use the ec2 role, so we have to use assume role scripts to make use of underlying ec2 profile inside serverless container, e.g.

role_arn='arn:aws:iam::account_id:role/ec2-role' 
role_session_name='ec2-test'
profile_name='ec2-test'

temp_role=$(aws sts assume-role \
     --role-arn $role_arn \
     --role-session-name $role_session_name)

export AWS_ACCESS_KEY_ID=$(echo $temp_role | jq -r .Credentials.AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $temp_role | jq -r .Credentials.SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $temp_role | jq -r .Credentials.SessionToken)

The above scripts can be replaced by https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configure/export-credentials.html with AWS cli version 2.

Additional context
Install aws cli v2 may need some effort to in Alpine as per aws/aws-cli#4685, it is possible as per https://docs.aws.amazon.com/cli/latest/userguide/getting-started-source-install.html - Alpine Linux container

Problem when deploying with Jenkins

Hi guys,

Thanks for your work on this image. I am currently using the docker image to build the pipeline on Jenkins. I got a strange error when it executes the sls deploy. I just wonder anyone has ever saw this before. Here is the error message:

I am quite wondering the way to solve this issue. Appreciated to help of any kinds. Thanks.


edit:
Sorry for open this issue, please just ignore it. just a simple typo on my side

Chore: Github actions isn't executing due to lack of activity

https://github.com/amaysim-au/docker-serverless/actions/workflows/deploy.yml

This scheduled workflow is disabled because there hasn't been activity in this repository for at least 60 days.


Serverless 2.53.X is out, but the latest docker image available is 2.44.0 from 2 months ago.

sls --version
Framework Core: 2.53.1
Plugin: 5.4.3
SDK: 4.2.6
Components: 3.14.2

Please manually re-execute the actions, or make some change so the action runs?

Thanks for the image! This is very helpful.

Unsupported Node version in example/apigw

The serverless.yml in the example/apigw contains a reference to an unsupported version of Node.js. This prevents the example from deploying successfully.

This should be updated to the latest supported version of Node.js for the Lambda Runtime as specified here: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

service: amaysim-apigw-example
package:
  artifact: package/package.zip
provider:
  name: aws
  runtime: nodejs6.10
  region: ${env:AWS_REGION}
  stage: ${env:ENV}

Dockerfile to use build ARG

At the moment the version is hard coded in two locations:

  • Makefile
  • Dockerfile

Propose to move the version injection in the Dockerfile to come from a build argument, with the default being no @ specific version (that is, a docker build . will default to the most recent serverless version).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.