Skip to content

Instantly share code, notes, and snippets.

@sheep-snow
Last active November 30, 2022 15:50
Show Gist options
  • Select an option

  • Save sheep-snow/39a5cf24be6c0f3500c3cc61321f9151 to your computer and use it in GitHub Desktop.

Select an option

Save sheep-snow/39a5cf24be6c0f3500c3cc61321f9151 to your computer and use it in GitHub Desktop.
awslambda-python-docker-baseimage
def handler(event, context):
'''descipt here'''
return {"statusCode": 200, "body": "OK"}
FROM amazon/aws-lambda-python:3.9
COPY . ${LAMBDA_TASK_ROOT}
ENV PYTHONUTF8=1
ENV APP_NAME=${APP_NAME:-SOME_APP_NAME}
# Install AWS Cli
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& aws --version
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false
# Install python environment
RUN poetry install --no-root --no-dev
CMD [ "app.handler" ]
[virtualenvs]
in-project = true
path = ".venv"
[tool.poetry]
name = "SOME_APP_NAME"
version = "0.1.0"
description = ""
authors = [""]
license = "MIT"
[tool.poetry.dependencies]
python = "^3.9"
boto3 = "^1.18"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment