-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (36 loc) · 1.7 KB
/
Dockerfile
File metadata and controls
58 lines (36 loc) · 1.7 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
58
# syntax=docker/dockerfile:1
FROM python:3.13-bookworm AS requirements-stage
WORKDIR /tmp
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="${PATH}:/root/.local/bin"
COPY ./pyproject.toml ./uv.lock* /tmp/
RUN uv export --format requirements.txt -o requirements.txt --no-editable --no-hashes --no-dev --no-emit-project
FROM python:3.13-bookworm AS build-stage
WORKDIR /wheel
COPY --from=requirements-stage /tmp/requirements.txt /wheel/requirements.txt
RUN pip wheel --wheel-dir=/wheel --no-cache-dir --requirement /wheel/requirements.txt
FROM python:3.13-bookworm AS metadata-stage
WORKDIR /tmp
RUN --mount=type=bind,source=./.git/,target=/tmp/.git/ \
git describe --tags --exact-match > /tmp/VERSION 2>/dev/null \
|| git rev-parse --short HEAD > /tmp/VERSION \
&& echo "Building version: $(cat /tmp/VERSION)"
FROM python:3.13-slim-bookworm
WORKDIR /app
ENV TZ=Asia/Shanghai DEBIAN_FRONTEND=noninteractive PYTHONPATH=/app
RUN ARCH=$(uname -m | sed 's/^aarch64$/arm64/') \
&& FOLDER="ffmpeg-8.0-audio-$ARCH-linux-gnu" \
&& apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& curl -sSL "https://github.com/MooncellWiki/ffmpeg-build/releases/download/v8.0-3/$FOLDER.tar.gz" -o /tmp/ffmpeg.tar.gz \
&& tar -xzf /tmp/ffmpeg.tar.gz -C /tmp/ \
&& cd /tmp/$FOLDER/bin/ \
&& mv * /usr/bin/ \
&& chmod +x /usr/bin/ffmpeg /usr/bin/ffprobe \
&& apt-get purge -y --auto-remove curl \
&& rm -rf /tmp/ffmpeg.tar.gz /tmp/$FOLDER
COPY --from=build-stage /wheel /wheel
RUN pip install --no-cache-dir --no-index --find-links=/wheel -r /wheel/requirements.txt && rm -rf /wheel
COPY --from=metadata-stage /tmp/VERSION /app/VERSION
COPY . /app/
ENTRYPOINT ["python", "-m", "torappu"]