-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (40 loc) · 1.36 KB
/
Dockerfile
File metadata and controls
57 lines (40 loc) · 1.36 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
FROM python:3.13 AS base
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project --no-dev
FROM base AS build
COPY . .
RUN uv build
FROM base AS execute
ENV PATH=/app/.venv/bin:$PATH
COPY --from=build /app/.venv ./.venv
COPY --from=build /app/dist .
RUN uv pip install --no-deps *.whl
COPY ./config ./config
ENTRYPOINT ["python", "-m", "notifier"]
FROM base AS test
ENV PATH=/app/.venv/bin:$PATH
RUN uv sync --frozen --no-install-project
RUN apt-get update && apt-get install -y default-mysql-client
COPY conftest.py .
COPY config/ config/
COPY tests/ tests/
COPY notifier/ notifier/
ENTRYPOINT ["pytest", "-vvx"]
FROM amazon/aws-lambda-python:3.13 AS execute_lambda
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY pyproject.toml uv.lock ./
RUN uv export --frozen --no-dev --no-emit-project > requirements.txt && \
uv pip install --system --no-cache -r requirements.txt
COPY --from=build /app/dist ${LAMBDA_TASK_ROOT}
RUN uv pip install --system --no-cache --no-deps ${LAMBDA_TASK_ROOT}/*.whl
COPY ./config ${LAMBDA_TASK_ROOT}/config
COPY ./lambda_function.py ${LAMBDA_TASK_ROOT}
CMD ["lambda_function.lambda_handler"]
FROM base AS typecheck
COPY . .
RUN uv sync --frozen
ENTRYPOINT ["uv", "run", "mypy", "notifier", "tests"]