Skip to content

Commit cf16655

Browse files
committed
stuff half working
1 parent 40b49f5 commit cf16655

File tree

22 files changed

+71
-78
lines changed

22 files changed

+71
-78
lines changed

packages/postgres-database/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
2929
# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
3030
RUN uv venv "${VIRTUAL_ENV}"
3131

32-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
32+
RUN --mount=type=cache,target=/root/.cache/uv \
3333
uv pip install --upgrade \
3434
pip~=24.0 \
3535
wheel \

packages/service-integration/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
6363
# packages may be moved to production image easily by copying the venv
6464
RUN uv venv "${VIRTUAL_ENV}"
6565

66-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
66+
RUN --mount=type=cache,target=/root/.cache/uv \
6767
uv pip install --upgrade \
6868
pip~=24.0 \
6969
wheel \
@@ -74,7 +74,7 @@ WORKDIR /build/packages/service-integration
7474
RUN \
7575
--mount=type=bind,source=packages,target=/build/packages,rw \
7676
--mount=type=bind,source=packages/service-integration,target=/build/packages/service-integration,rw \
77-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
77+
--mount=type=cache,target=/root/.cache/uv \
7878
uv pip install \
7979
--requirement requirements/prod.txt \
8080
&& uv pip list

requirements/tools/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
3030

3131
RUN uv venv "${VIRTUAL_ENV}"
3232

33-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
33+
RUN --mount=type=cache,target=/root/.cache/uv \
3434
uv pip install --upgrade \
3535
pip~=24.0 \
3636
wheel \
@@ -39,7 +39,7 @@ RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
3939

4040

4141
# devenv
42-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
42+
RUN --mount=type=cache,target=/root/.cache/uv \
4343
uv pip install \
4444
pip-tools \
4545
pipreqs \

services/agent/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
8181
# packages may be moved to production image easily by copying the venv
8282
RUN uv venv "${VIRTUAL_ENV}"
8383

84-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
84+
RUN --mount=type=cache,target=/root/.cache/uv \
8585
uv pip install --upgrade \
8686
pip~=24.0 \
8787
wheel \
@@ -93,7 +93,7 @@ WORKDIR /build
9393
# NOTE: copies to /build to avoid overwriting later which would invalidate this layer
9494
RUN \
9595
--mount=type=bind,source=services/agent/requirements/_base.txt,target=_base.txt \
96-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
96+
--mount=type=cache,target=/root/.cache/uv \
9797
uv pip install \
9898
--requirement _base.txt
9999

@@ -113,7 +113,7 @@ WORKDIR /build/services/agent
113113
RUN \
114114
--mount=type=bind,source=packages,target=/build/packages,rw \
115115
--mount=type=bind,source=services/agent,target=/build/services/agent,rw \
116-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
116+
--mount=type=cache,target=/root/.cache/uv \
117117
uv pip install \
118118
--requirement requirements/prod.txt \
119119
&& uv pip list

services/api-server/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
7777
# packages may be moved to production image easily by copying the venv
7878
RUN uv venv "${VIRTUAL_ENV}"
7979

80-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
80+
RUN --mount=type=cache,target=/root/.cache/uv \
8181
uv pip install --upgrade \
8282
pip~=24.0 \
8383
wheel \
@@ -89,7 +89,7 @@ WORKDIR /build
8989
# NOTE: copies to /build to avoid overwriting later which would invalidate this layer
9090
RUN \
9191
--mount=type=bind,source=services/api-server/requirements/_base.txt,target=_base.txt \
92-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
92+
--mount=type=cache,target=/root/.cache/uv \
9393
uv pip install \
9494
--requirement _base.txt
9595

@@ -109,7 +109,7 @@ WORKDIR /build/services/api-server
109109
RUN \
110110
--mount=type=bind,source=packages,target=/build/packages,rw \
111111
--mount=type=bind,source=services/api-server,target=/build/services/api-server,rw \
112-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
112+
--mount=type=cache,target=/root/.cache/uv \
113113
uv pip install \
114114
--requirement requirements/prod.txt \
115115
&& uv pip list

services/autoscaling/Dockerfile

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# syntax=docker/dockerfile:1
2+
3+
# Define arguments in the global scope
24
ARG PYTHON_VERSION="3.11.9"
5+
ARG UV_VERSION="0.4"
6+
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
7+
# we docker image is built based on debian
38
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
49

510
#
611
# USAGE:
7-
# cd sercices/autoscaling
12+
# cd services/autoscaling
813
# docker build -f Dockerfile -t autoscaling:prod --target production ../../
914
# docker run autoscaling:prod
1015
#
@@ -90,31 +95,21 @@ RUN --mount=type=cache,target=/var/cache/apt,mode=0755,sharing=private \
9095
build-essential
9196

9297
# install UV https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
93-
ARG UV_VERSION="0.4"
94-
COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
95-
98+
COPY --from=uv_build /uv /uvx /bin/
99+
# https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
100+
ENV UV_COMPILE_BYTECODE=1
96101

97102
# NOTE: python virtualenv is used here such that installed
98103
# packages may be moved to production image easily by copying the venv
99104
RUN uv venv "${VIRTUAL_ENV}"
100105

101-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
106+
RUN --mount=type=cache,target=/root/.cache/uv \
102107
uv pip install --upgrade \
103-
pip~=24.0 \
104108
wheel \
105109
setuptools
106110

107111
WORKDIR /build
108112

109-
# install base 3rd party dependencies
110-
# NOTE: copies to /build to avoid overwriting later which would invalidate this layer
111-
RUN \
112-
--mount=type=bind,source=services/autoscaling/requirements/_base.txt,target=_base.txt \
113-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
114-
uv pip install \
115-
--requirement _base.txt
116-
117-
118113
# --------------------------Prod-depends-only stage -------------------
119114
# This stage is for production only dependencies that get partially wiped out afterwards (final docker image concerns)
120115
#
@@ -130,9 +125,9 @@ WORKDIR /build/services/autoscaling
130125
RUN \
131126
--mount=type=bind,source=packages,target=/build/packages,rw \
132127
--mount=type=bind,source=services/autoscaling,target=/build/services/autoscaling,rw \
133-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
134-
uv pip install \
135-
--requirement requirements/prod.txt \
128+
--mount=type=cache,target=/root/.cache/uv \
129+
uv pip sync \
130+
requirements/prod.txt \
136131
&& uv pip list
137132

138133

services/autoscaling/docker/boot.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ if [ "${SC_BUILD_TARGET}" = "development" ]; then
2323
python --version | sed 's/^/ /'
2424
command -v python | sed 's/^/ /'
2525

26-
cd services/autoscaling || exit 1
27-
pip install uv
28-
uv pip --quiet --no-cache-dir install -r requirements/dev.txt
29-
cd - || exit 1
30-
echo "$INFO" "PIP :"
31-
uv pip list | sed 's/^/ /'
26+
cd services/autoscaling
27+
uv pip --quiet --no-cache-dir sync requirements/dev.txt
28+
cd -
29+
uv pip list
3230
fi
3331

3432
#

services/catalog/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
7878
# packages may be moved to production image easily by copying the venv
7979
RUN uv venv "${VIRTUAL_ENV}"
8080

81-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
81+
RUN --mount=type=cache,target=/root/.cache/uv \
8282
uv pip install --upgrade \
8383
pip~=24.0 \
8484
wheel \
@@ -90,7 +90,7 @@ WORKDIR /build
9090
# NOTE: copies to /build to avoid overwriting later which would invalidate this layer
9191
RUN \
9292
--mount=type=bind,source=services/catalog/requirements/_base.txt,target=_base.txt \
93-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
93+
--mount=type=cache,target=/root/.cache/uv \
9494
uv pip install \
9595
--requirement _base.txt
9696

@@ -110,7 +110,7 @@ WORKDIR /build/services/catalog
110110
RUN \
111111
--mount=type=bind,source=packages,target=/build/packages,rw \
112112
--mount=type=bind,source=services/catalog,target=/build/services/catalog,rw \
113-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
113+
--mount=type=cache,target=/root/.cache/uv \
114114
uv pip install \
115115
--requirement requirements/prod.txt \
116116
&& uv pip list

services/clusters-keeper/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
9797
# packages may be moved to production image easily by copying the venv
9898
RUN uv venv "${VIRTUAL_ENV}"
9999

100-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
100+
RUN --mount=type=cache,target=/root/.cache/uv \
101101
uv pip install --upgrade \
102102
pip~=24.0 \
103103
wheel \
@@ -109,7 +109,7 @@ WORKDIR /build
109109
# NOTE: copies to /build to avoid overwriting later which would invalidate this layer
110110
RUN \
111111
--mount=type=bind,source=services/clusters-keeper/requirements/_base.txt,target=_base.txt \
112-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
112+
--mount=type=cache,target=/root/.cache/uv \
113113
uv pip install \
114114
--requirement _base.txt
115115

@@ -129,7 +129,7 @@ WORKDIR /build/services/clusters-keeper
129129
RUN \
130130
--mount=type=bind,source=packages,target=/build/packages,rw \
131131
--mount=type=bind,source=services/clusters-keeper,target=/build/services/clusters-keeper,rw \
132-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
132+
--mount=type=cache,target=/root/.cache/uv \
133133
uv pip install \
134134
--requirement requirements/prod.txt \
135135
&& uv pip list

services/dask-sidecar/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ COPY --from=ghcr.io/astral-sh/uv:${UV_VERSION} /uv /uvx /bin/
8787
# NOTE: python virtualenv is used here such that installed packages may be moved to production image easily by copying the venv
8888
RUN uv venv "${VIRTUAL_ENV}"
8989

90-
RUN --mount=type=cache,mode=0755,target=/root/.cache/uv \
90+
RUN --mount=type=cache,target=/root/.cache/uv \
9191
uv pip install --upgrade \
9292
pip~=24.0 \
9393
wheel \
@@ -98,7 +98,7 @@ WORKDIR /build
9898
# install base 3rd party dependencies (NOTE: this speeds up devel mode)
9999
RUN \
100100
--mount=type=bind,source=services/dask-sidecar/requirements/_base.txt,target=_base.txt \
101-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
101+
--mount=type=cache,target=/root/.cache/uv \
102102
uv pip install \
103103
--requirement _base.txt
104104

@@ -117,7 +117,7 @@ WORKDIR /build/services/dask-sidecar
117117
RUN \
118118
--mount=type=bind,source=packages,target=/build/packages,rw \
119119
--mount=type=bind,source=services/dask-sidecar,target=/build/services/dask-sidecar,rw \
120-
--mount=type=cache,mode=0755,target=/root/.cache/uv \
120+
--mount=type=cache,target=/root/.cache/uv \
121121
uv pip install \
122122
--requirement requirements/prod.txt \
123123
&& uv pip list

0 commit comments

Comments
 (0)