-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
34 lines (25 loc) · 900 Bytes
/
Dockerfile
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
# Build arguments
ARG PYTHON_VERSION=3.12
ARG UV_VERSION=0.4.27
# Create a temporary stage to pull the uv binary
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv-stage
# Main stage
FROM python:${PYTHON_VERSION}-alpine AS main
# Copy the uv binary from the temporary stage to the main stage
COPY --from=uv-stage /uv /bin/uv
# Copy only requirements (caching in Docker layer)
COPY pyproject.toml uv.lock /code/
# Sync the project into a new environment (no dev dependencies)
WORKDIR /code
# Copy code and static folders
COPY ./app /code/app
COPY ./static /code/static
# Install the project
RUN uv sync --frozen --no-cache --no-dev
# Copy crontabs file and make it executable
COPY ./build/overfast-crontab /etc/crontabs/root
RUN chmod +x /etc/crontabs/root
# For dev image, copy the tests and install necessary dependencies
FROM main as dev
RUN uv sync --frozen --no-cache
COPY ./tests /code/tests