mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-25 10:08:36 +02:00
ci: try to improve build times using uv
This commit is contained in:
@@ -3,11 +3,15 @@ FROM python:3.11-slim-bookworm AS python-build-stage
|
|||||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
|
curl \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install uv for faster package resolution
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
||||||
|
|
||||||
COPY ./requirements.txt .
|
COPY ./requirements.txt .
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
pip wheel --wheel-dir /usr/src/app/wheels -r requirements.txt
|
uv pip install --system --compile-bytecode -r requirements.txt
|
||||||
|
|
||||||
FROM node:lts-alpine AS vite_build
|
FROM node:lts-alpine AS vite_build
|
||||||
WORKDIR /usr/src/frontend
|
WORKDIR /usr/src/frontend
|
||||||
@@ -29,6 +33,10 @@ ENV APP_VERSION=$VERSION
|
|||||||
|
|
||||||
COPY --from=vite_build /usr/src/frontend/build /usr/src/frontend/build
|
COPY --from=vite_build /usr/src/frontend/build /usr/src/frontend/build
|
||||||
|
|
||||||
|
# Copy Python packages from build stage
|
||||||
|
COPY --from=python-build-stage /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
||||||
|
COPY --from=python-build-stage /usr/local/bin /usr/local/bin
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN addgroup --system app && \
|
RUN addgroup --system app && \
|
||||||
@@ -37,15 +45,11 @@ RUN addgroup --system app && \
|
|||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Install python dependencies from wheels
|
# Install runtime dependencies
|
||||||
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/apt \
|
RUN --mount=type=cache,target=/root/.cache/apt \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install --no-install-recommends -y gettext supervisor && \
|
apt-get install --no-install-recommends -y gettext supervisor libpq5 && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/*
|
||||||
pip install --upgrade pip && \
|
|
||||||
pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* && \
|
|
||||||
rm -rf /wheels/ \
|
|
||||||
|
|
||||||
COPY --chown=app:app ./docker/prod/django/start /start
|
COPY --chown=app:app ./docker/prod/django/start /start
|
||||||
COPY --chown=app:app ./docker/prod/procrastinate/start /start-procrastinate
|
COPY --chown=app:app ./docker/prod/procrastinate/start /start-procrastinate
|
||||||
|
|||||||
Reference in New Issue
Block a user