-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (27 loc) · 874 Bytes
/
Copy pathDockerfile
File metadata and controls
40 lines (27 loc) · 874 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
37
38
39
40
# syntax=docker/dockerfile:1
FROM ubuntu:24.04 AS build
COPY --from=ghcr.io/astral-sh/uv:0.11 /uv /uvx /bin/
# Use the system python and compile bytecode for faster container startup.
ENV UV_PYTHON_PREFERENCE=only-system \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-dev \
python3-venv \
build-essential \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/*
COPY . /pythontemplate
WORKDIR /pythontemplate
RUN uv sync --no-default-groups \
&& rm -rf .git
FROM ubuntu:24.04
ENV PATH="/pythontemplate/.venv/bin:$PATH"
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /pythontemplate /pythontemplate
WORKDIR /pythontemplate