Renovate Bot
a3e32c1360
All checks were successful
ZeroDownTime/sns-alert-hub/pipeline/pr-main This commit looks good
57 lines
1.5 KiB
Docker
57 lines
1.5 KiB
Docker
# Stage 1 - bundle base image + runtime
|
|
FROM python:3.13-alpine3.20 AS python-alpine
|
|
ARG ALPINE="v3.20"
|
|
|
|
# Install GCC (Alpine uses musl but we compile and link dependencies with GCC)
|
|
RUN echo "@kubezero https://cdn.zero-downtime.net/alpine/${ALPINE}/kubezero" >> /etc/apk/repositories && \
|
|
wget -q -O /etc/apk/keys/stefan@zero-downtime.net-61bb6bfb.rsa.pub https://cdn.zero-downtime.net/alpine/stefan@zero-downtime.net-61bb6bfb.rsa.pub
|
|
|
|
RUN apk -U --no-cache upgrade && \
|
|
apk --no-cache add \
|
|
libstdc++
|
|
|
|
|
|
# Stage 2 - build function and dependencies
|
|
FROM python-alpine AS build-image
|
|
ARG TAG="latest"
|
|
|
|
# Install aws-lambda-cpp build dependencies
|
|
RUN apk --no-cache add \
|
|
build-base \
|
|
libtool \
|
|
autoconf \
|
|
automake \
|
|
make \
|
|
cmake \
|
|
libcurl \
|
|
libffi-dev \
|
|
openssl-dev \
|
|
elfutils-dev
|
|
# cargo
|
|
|
|
# Install requirements
|
|
COPY requirements.txt requirements.txt
|
|
RUN export MAKEFLAGS="-j$(nproc)" && \
|
|
pip install -r requirements.txt --target /app
|
|
|
|
# Install our app
|
|
COPY app.py /app
|
|
|
|
# Set internal __version__ to our own container TAG
|
|
RUN sed -i -e "s/^__version__ =.*/__version__ = \"${TAG}\"/" /app/app.py
|
|
|
|
# Stage 3 - final runtime image
|
|
FROM python-alpine
|
|
|
|
RUN apk --no-cache add \
|
|
zstd-libs
|
|
|
|
WORKDIR /app
|
|
COPY --from=build-image /app /app
|
|
|
|
ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ]
|
|
CMD [ "app.handler" ]
|
|
|
|
LABEL zero-downtime.net.image.maintainer="stefan@zero-downtime.net" \
|
|
zero-downtime.net.image.license="AGPLv3"
|