This commit is contained in:
2026-08-29 10:49:36 +00:00
parent 103983846d
commit 73fba17711
11 changed files with 632 additions and 107 deletions
+38 -16
View File
@@ -1,24 +1,46 @@
FROM python:latest
FROM python:3.14-slim
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python - && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false && \
mkdir /app
# Install git required for cloning the repo
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
ADD https://git.tanshu.com/tanshu/barker/raw/branch/main/frank/pyproject.toml /app/pyproject.toml
RUN poetry install --no-root --no-dev
# Install uv
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ADD https://git.tanshu.com/api/v1/repos/tanshu/barker/tags /tags.json
RUN git clone --single-branch --depth 1 https://git.tanshu.com/tanshu/barker.git /repo
RUN mv /repo/frank/* /app
# Compile bytecode
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
ENV UV_COMPILE_BYTECODE=1
# Disable development dependencies
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-a-project
ENV UV_NO_DEV=1
# uv Cache
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#caching
ENV UV_LINK_MODE=copy
WORKDIR /app/
# Place executables in the environment at the front of the path
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
ENV PATH="/app/.venv/bin:$PATH"
# Install dependencies
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=barker/uv.lock,target=uv.lock \
--mount=type=bind,source=barker/pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project
COPY /frank ./
# Sync the project
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked
ENV PYTHONPATH=/app
RUN chmod 777 /app/worker-start.sh \
&& ln -s /app/worker-start.sh /usr/local/bin/worker-start.sh \
&& ln -s /app/worker-start.sh /
RUN chmod +x /app/worker-start.sh \
&& ln -s /app/worker-start.sh /usr/local/bin/worker-start.sh
CMD ["bash", "worker-start.sh"]