Skip to content

Commit f217ea2

Browse files
committed
Build Pulsar wheel in coexecutor Dockerfile
Build wheel automatically when building the Docker image. Exclude the source code from the output image through a multistage build.
1 parent 3b4577d commit f217ea2

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docker/coexecutor/Dockerfile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# use the root of the repository as context, i.e. `docker build . -f ./docker/coexecutor/Dockerfile`
2+
3+
FROM python:3.12-bookworm as build_wheel
4+
5+
ENV PIP_ROOT_USER_ACTION=ignore
6+
7+
WORKDIR /build
8+
9+
# install requirements
10+
COPY requirements.txt .
11+
COPY dev-requirements.txt .
12+
RUN pip install --no-cache-dir --upgrade pip \
13+
&& pip install --no-cache-dir setuptools -r requirements.txt -r dev-requirements.txt
14+
15+
# build Pulsar wheel
16+
COPY . .
17+
RUN python setup.py sdist bdist_wheel
18+
19+
120
FROM python:3.12-bookworm
221

322
ENV PYTHONUNBUFFERED 1
@@ -49,7 +68,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
4968
&& apt-get -y autoremove \
5069
&& apt-get clean && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log
5170

52-
ADD pulsar_app-*-py2.py3-none-any.whl /
71+
COPY --from=build_wheel /build/dist/pulsar_app-*-py2.py3-none-any.whl /
5372

5473
SHELL ["/bin/bash", "-c"]
5574

0 commit comments

Comments
 (0)