From 2ebe1af6370bb983a156bcfe84629fefe667d29e Mon Sep 17 00:00:00 2001 From: Gagan Tunuguntla Date: Thu, 28 Nov 2019 09:32:48 -0500 Subject: [PATCH] local docker set up --- api/Dockerfile | 10 ++++++++++ api/standup-api.sh | 2 ++ docker-compose.yml | 15 +++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 api/Dockerfile create mode 100644 api/standup-api.sh diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 0000000..c21f67b --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.7-alpine +RUN apk update && \ + apk upgrade && \ + apk add bash && \ + apk add --no-cache --virtual build-deps build-base gcc && \ + pip install aws-sam-cli==0.34.0 && \ + apk del build-deps +RUN mkdir /app +WORKDIR /app +CMD ["tail", "-f", "/dev/null"] diff --git a/api/standup-api.sh b/api/standup-api.sh new file mode 100644 index 0000000..113a7e6 --- /dev/null +++ b/api/standup-api.sh @@ -0,0 +1,2 @@ +# Starts the API with SAM LOCAL +sam local start-api --host 0.0.0.0 -p 3000 -v $SAM_LOCAL_ABSOLUTE_PATH diff --git a/docker-compose.yml b/docker-compose.yml index d01e8ef..f36d083 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,3 +13,18 @@ services: - /usr/src/app/node_modules ports: - "4200:4200" + # -------------------------------------------------------------------------- + # BACKEND WRITTEN IN AWS SAM LOCAL + # -------------------------------------------------------------------------- + serverless-lambda-api: + build: ./api + container_name: serverless-lambda-api + env_file: + .env + volumes: + - ./api:/app + - /var/run/docker.sock:/var/run/docker.sock + - ./api:${SAM_LOCAL_ABSOLUTE_PATH} + ports: + - "3000:3000" + command: sh standup-api.sh