-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile.aws
More file actions
59 lines (47 loc) · 1.57 KB
/
Copy pathDockerfile.aws
File metadata and controls
59 lines (47 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Start with the AWS Lambda Python image
FROM public.ecr.aws/lambda/python:3.13
# Install system dependencies
RUN microdnf install -y \
ca-certificates \
krb5-libs \
libicu \
zlib \
openssl \
tar \
gzip \
gcc \
gcc-c++ \
python3-devel \
&& microdnf clean all
# Set the working directory
WORKDIR ${LAMBDA_TASK_ROOT}
# Copy project files for building and installing dependencies
COPY pyproject.toml setup.py ./
COPY src ./src
# Install uv for dependency resolution
RUN pip install --no-cache-dir uv
# Generate requirements.txt from pyproject.toml
RUN uv pip compile pyproject.toml -o requirements.txt
# Install dependencies from generated requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Build Cython extensions in place
RUN python setup.py build_ext --inplace
# Build arguments for configuration with defaults
ARG APP_RATE_LIMIT_PER_DAY=8000
# Set environment variables with defaults for AWS Lambda
# Logging configuration
ENV LOG_LEVEL=INFO
ENV LOG_FORMAT=json
ENV PERFORMANCE_THRESHOLD_MS=2000
# Logo fetching configuration
ENV DISABLE_LOGO_FETCHING=false
ENV LOGO_TIMEOUT_SECONDS=1
ENV LOGO_CIRCUIT_BREAKER_THRESHOLD=5
ENV LOGO_CIRCUIT_BREAKER_TIMEOUT=300
# Rate Limiting Configuration:
# Self-deploying users can set their daily rate limit via APP_RATE_LIMIT_PER_DAY.
# If not set, it defaults to 8000 requests per day.
# Example: docker run -e APP_RATE_LIMIT_PER_DAY=15000 my-application-image
ENV APP_RATE_LIMIT_PER_DAY=${APP_RATE_LIMIT_PER_DAY}
# Set the entry point for the AWS Lambda function
CMD ["src/main.handler"]