Thursday, September 07, 2017

Serverless Local build in Docker - Part 1

I wanted to set up a serverless-local build for using on a friends project. This will allow a certain amount of localised testing before pushing changes to the AWS Lambda service.
I decided to build a Centos VM and then added docker this allowed for a lot of portability.
Here are the steps I took

First, build the centos VM that is pretty straightforward for most and there are lots of good guides around. I use Virtual Box from Oracle as my VM service of choice.

Next installed Docker, just follow along here and you shouldn't have much trouble installing docker and getting a centos container running
Install Docker
yum install docker
Don't forget to test it with
docker run hello-world

I then used this container config to install a centos container with node already installed
https://github.com/lloydbenson/docker-centos-7-node This is a lot easier than building the entire node and npm install within a bare container. That can be another post when I get that one up

Once this is up then you can use the page here  to install serverless-local into your project and allow you to do a lot of local testing https://blog.gorillastack.com/serverless-framework-local-development-environments/

No comments: