forked from TeKrop/overfast-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 967 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 967 Bytes
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
# Build arguments
ARG PYTHON_VERSION=3.14
ARG UV_VERSION=0.9.2
# 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
# Install the project
RUN apk add --no-cache build-base \
&& uv sync --frozen --no-cache --no-dev \
&& apk del build-base
# Copy code and static folders
COPY ./app /code/app
COPY ./static /code/static
# 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