forked from parazyd/blck
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 1.09 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
# Use Alpine 3.21.0 as the base image
FROM alpine:3.21.0
# Install necessary dependencies using apk (Alpine package manager)
RUN apk update && apk upgrade && \
apk add --no-cache \
curl \
python3 \
libmagic \
&& rm -rf /var/cache/apk/*
# Install UV Astra (Python package manager)
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
# Ensure the UV binary is in the PATH by setting it explicitly
ENV PATH="/root/.local/bin:${PATH}"
# Set the working directory for the application
WORKDIR /app
# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy
# Copy uv.lock and pyproject.toml before the application code to leverage Docker layer caching
COPY uv.lock pyproject.toml /app/
# Install the project's dependencies using UV Astra's sync command
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev
# Copy the rest of the application code
COPY . /app
# Expose a port
EXPOSE 8080
# Set the entrypoint to run your Python application with UV run command
ENTRYPOINT ["uv", "run", "gunicorn", "-c", "gunicorn_config.py", "blck:app"]