Skip to content

Commit 5264b63

Browse files
committed
Reduce images size
1 parent b6e93d3 commit 5264b63

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

docker/Dockerfile.scheduler

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ ENV PYTHONPATH=/app
1313
COPY ./pyproject.toml ./poetry.lock* /app/
1414

1515
RUN pip install --upgrade pip setuptools wheel packaging
16-
RUN poetry install --no-root --extras "scheduler" --extras "server" --without test,docs,dev
16+
RUN --mount=type=cache,target=/root/.cache/pypoetry \
17+
poetry install \
18+
--no-root \
19+
# TODO: make scheduler independent from server
20+
--extras "server" \
21+
--extras "scheduler" \
22+
--without test,docs,dev
1723

1824
COPY ./docker/entrypoint_scheduler.sh /app/entrypoint.sh
1925
ENTRYPOINT ["/app/entrypoint.sh"]
@@ -25,5 +31,11 @@ COPY ./syncmaster/ /app/syncmaster/
2531

2632
FROM base AS test
2733

28-
RUN poetry install --no-root --all-extras --with test --without docs,dev
34+
RUN --mount=type=cache,target=/root/.cache/pypoetry \
35+
poetry install \
36+
--no-root \
37+
--extras "scheduler" \
38+
--with test \
39+
--without docs,dev
40+
2941
RUN sed -i 's/python -m/coverage run -m/g' /app/entrypoint.sh

docker/Dockerfile.server

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ ENV PYTHONPATH=/app
1414
COPY ./pyproject.toml ./poetry.lock* /app/
1515

1616
RUN pip install --upgrade pip setuptools wheel packaging
17-
RUN poetry install --no-root --extras "server" --without test,docs,dev
17+
RUN --mount=type=cache,target=/root/.cache/pypoetry \
18+
poetry install \
19+
--no-root \
20+
--extras "server" \
21+
--without test,docs,dev
1822

1923
COPY ./docker/entrypoint_server.sh /app/entrypoint.sh
2024
ENTRYPOINT ["/app/entrypoint.sh"]
@@ -41,5 +45,11 @@ ENV SYNCMASTER__SERVER__OPENAPI__SWAGGER__JS_URL=/static/swagger/swagger-ui-bund
4145

4246
FROM base AS test
4347

44-
RUN poetry install --no-root --extras "server" --with test --without docs,dev
48+
RUN --mount=type=cache,target=/root/.cache/pypoetry \
49+
poetry install \
50+
--no-root \
51+
--extras "server" \
52+
--with test \
53+
--without docs,dev
54+
4555
RUN sed -i 's/python -m/coverage run -m/g' /app/entrypoint.sh

docker/Dockerfile.worker

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ ENV PYTHONPATH=/app
3030
COPY ./pyproject.toml ./poetry.lock* /app/
3131

3232
RUN pip install --upgrade pip setuptools wheel packaging
33-
RUN poetry install --no-root --extras "worker" --without test,docs,dev
33+
RUN --mount=type=cache,target=/root/.cache/pypoetry \
34+
poetry install \
35+
--no-root \
36+
--extras "worker" \
37+
--without test,docs,dev
3438

3539
COPY ./docker/entrypoint_worker.sh /app/entrypoint.sh
3640
ENTRYPOINT ["/app/entrypoint.sh"]
@@ -46,6 +50,13 @@ FROM base AS test
4650

4751
ENV SYNCMASTER__WORKER__CREATE_SPARK_SESSION_FUNCTION=tests.spark.get_worker_spark_session
4852

49-
# CI runs tests in the worker container, so we need server dependencies too
50-
RUN poetry install --no-root --all-extras --with test --without docs,dev
53+
# CI runs tests in the worker container, so we need server & scheduler dependencies too
54+
55+
RUN --mount=type=cache,target=/root/.cache/pypoetry \
56+
poetry install \
57+
--no-root \
58+
--all-extras \
59+
--with test \
60+
--without docs,dev
61+
5162
RUN sed -i 's/python -m/coverage run -m/g' /app/entrypoint.sh

0 commit comments

Comments
 (0)