Skip to content

add Dockerfile #74

@eric-s-s

Description

@eric-s-s

It might be good to add an opinionated dockerfile. something like from: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv

ARG UV_VERSION=
ARG PYTHON_VERSION=
ARG BUILD_WORKDIR=/build
ARG APP_WORKDIR=/app

FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv-stage

FROM dev-image AS build-stage
ARG BUILD_WORKDIR

COPY --from=uv-stage /uv /uvx /bin/
WORKDIR=${BUILD_WORKDIR}
COPY . . 
RUN uv python install
RUN uv sync --locked --no-dev
RUN uv pip freeze > requirements.txt
RUN uv build

FROM dev-image AS install-stage

ARG BUILD_WORKDIR
ARG APP_WORKDIR

WORKDIR=${APP_WORKDIR}
COPY --from=build-stage ${BUILD_WORKDIR}/build .
COPY --from=build-stage ${BUILD_WORKDIR}/requirments.txt .

RUN venv --upgrade-deps venv
RUN source venv/activate
RUN pip install -r requirements.txt
RUN pip install dist/*.whl

FROM prod-image AS run-stage

ARG APP_WORKDIR
ARG APP_VENV
WORKDIR=${APP_WORKDIR}

COPY --from=install-stage ${APP_WORKDIR}/venv .

RUN export PATH="${APP_WORKDIR}/venv:$PATH"

more to come. I forget some syntax stuff here. I'll have to experiment. Also, I think that this requires some stuff from https://docs.astral.sh/uv/guides/integration/docker/#optimizations. I'll need to test this and make sure that it actually works, but that is hard from windows machine. maybe I'll need to install WSL finally

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions