You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to build only my dependencies for a multi-stage docker build, without needing my code, and using pyproject.toml only?
I'm managing this with
FROM python:3.12-slim as builder
RUN apt-get update \
&& apt-get -y install build-essential libpq-dev
RUN pip install --upgrade pip --root-user-action=ignore && \
pip install hatch --root-user-action=ignore
WORKDIR /deps
COPY pyproject.toml /deps
RUN mkdir -p /deps/src && \
touch /deps/README.md && \
hatch dep show requirements > requirements.txt
RUN pip install -t dist -r requirements.txt --root-user-action=ignore
# Final Layer
FROM python:3.12-slim
RUN apt-get update \
&& apt-get install -y libpq5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /deps/dist/ /usr/local/lib/python3.12/site-packages/
COPY --from=builder /deps/dist/bin /usr/local/bin
COPY . /app/
RUN pip install --upgrade pip --root-user-action=ignore && \
pip install -e . --root-user-action=ignore
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
But it would be nice to just be able to do this directly with hatch, and be able to build a wheel that I can explicitly pull from my build stage and just install as a single file.
The text was updated successfully, but these errors were encountered:
Is there a way to build only my dependencies for a multi-stage docker build, without needing my code, and using pyproject.toml only?
I'm managing this with
But it would be nice to just be able to do this directly with hatch, and be able to build a wheel that I can explicitly pull from my build stage and just install as a single file.
The text was updated successfully, but these errors were encountered: