deploying a simple image to use in serverless development and deployment.
# Dockerfile
FROM node:alpine
RUN apk update && \
apk add --update --no-cache \
python3 \
py3-pip \
groff \
less \
git \
openssh
RUN pip3 install --upgrade pip
RUN pip3 --no-cache-dir install --upgrade awscli
RUN aws --version
RUN npm install -g serverless
basically this is the image, very simple but will include all the basic tools you will need when developing serverless function with aws lambda.
deploying to docker hub:
docker build -t serverless .
docker login
docker tag serverless username/serverless:tag
docker push username/serverless:tag
simple usage: add docker-compose.yml file and run.
# docker-compose.yml
version: "3.2"
services:
service-name:
container_name: service-name
image: niradler/serverless
restart: always
env_file:
- .env
volumes:
- ./:/app
ports:
- "3001:3001"
command: sh -c 'cd app && npm i && npm run start'
checkout the description on docker hub.