Skip to content

Commit

Permalink
Build Pulsar wheel in coexecutor Dockerfile
Browse files Browse the repository at this point in the history
Build wheel automatically when building the Docker image. Exclude the source code from the output image through a multistage build.
  • Loading branch information
kysrpex committed Nov 14, 2024
1 parent 689c213 commit ee1f20a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docker/coexecutor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# use the root of the repository as context, i.e. `docker build . -f ./docker/coexecutor/Dockerfile`

FROM python:3.12-bookworm as build_wheel

ENV PIP_ROOT_USER_ACTION=ignore

WORKDIR /build

# install requirements
COPY requirements.txt .
COPY dev-requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir setuptools -r requirements.txt -r dev-requirements.txt

# build Pulsar wheel
COPY . .
RUN python setup.py sdist bdist_wheel


FROM python:3.12-bookworm

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

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

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

Expand Down

0 comments on commit ee1f20a

Please sign in to comment.