# base for all images
FROM amazon/aws-lambda-python:3.8 AS base

LABEL project=cache_test

COPY requirements.txt ./

RUN pip install --upgrade pip \
    pip install -r requirements.txt

# image running lambda function
FROM base AS function

COPY src/ ./src

EXPOSE 8080

CMD [ "src.app.handler" ]

# image running lint and test
FROM base AS lint_and_test

COPY requirements-test.txt ./

RUN pip install -r requirements-test.txt

COPY lint-and-test.sh docker-compose.yaml .flake8 ./
COPY src/ ./src
COPY tests/ ./tests

EXPOSE 8000

ENTRYPOINT [ "/var/task/lint-and-test.sh" ]
