0% found this document useful (0 votes)
176 views1 page

Docker File

This document outlines a multi-stage Dockerfile for building a Python application using Debian as the base image. It sets up various environments for development, application, and testing, including the installation of necessary packages and dependencies. The final stage exposes a port and defines a health check for the application running with the uv framework.

Uploaded by

fdzdragon82
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
176 views1 page

Docker File

This document outlines a multi-stage Dockerfile for building a Python application using Debian as the base image. It sets up various environments for development, application, and testing, including the installation of necessary packages and dependencies. The final stage exposes a port and defines a health check for the application running with the uv framework.

Uploaded by

fdzdragon82
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

FROM debian:bookworm-slim AS base

ENV HOME=/root

ARG GITHUB_BUILD=false \
VERSION

ENV GITHUB_BUILD=${GITHUB_BUILD}\
VERSION=${VERSION}\
DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
DISPLAY=:0\
PATH="${HOME}/.local/bin:$PATH"

WORKDIR /app

RUN apt-get update && \


apt-get install -y --no-install-recommends --no-install-suggests xauth xvfb
scrot curl chromium chromium-driver ca-certificates

ADD [Link] [Link]


RUN sh [Link] && uv --version

FROM base AS devcontainer


RUN apt install -y git && apt upgrade -y
ENV UV_LINK_MODE=copy
ENTRYPOINT [ "sleep", "infinity" ]

FROM base AS app


COPY [Link] [Link] ./
RUN --mount=type=cache,target=${HOME}/.cache/uv uv sync

# SeleniumBase does not come with an arm64 chromedriver binary


RUN cd .venv/lib/*/site-packages/seleniumbase/drivers && rm -f uc_driver && ln -
s /usr/bin/chromedriver uc_driver
COPY . .

FROM app AS test


RUN --mount=type=cache,target=${HOME}/.cache/uv uv sync --group test
RUN ./[Link]

FROM app
EXPOSE 8191
HEALTHCHECK --interval=15m --timeout=30s --start-period=5s --retries=3 CMD
[ "curl", "[Link] ]
ENTRYPOINT ["uv", "run", "[Link]"]

You might also like