Skip to content

Commit

Permalink
docker: Fix python venv setup
Browse files Browse the repository at this point in the history
- Copy python libraries from venv source location
- Activate venv in all RUNs separatly because each RUN is executed in a new shell, so the environment changes do not persist between RUN commands.
  • Loading branch information
ShahanaFarooqui committed Jan 14, 2025
1 parent 1fba2d4 commit 5f5ae0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,16 @@ RUN mkdir -p /root/.venvs && \
COPY --from=builder /tmp/rustup_install_opts.txt /tmp/rustup_install_opts.txt
# Setup ENV $RUSTUP_INSTALL_OPTS for this stage
RUN export $(cat /tmp/rustup_install_opts.txt)
ENV PATH="/root/.cargo/bin:/root/.venvs/cln/bin:$PATH"
ENV PATH="/root/.cargo/bin:/root/.venvs/cln/lib:$PATH"
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RUSTUP_INSTALL_OPTS}

WORKDIR /opt/lightningd/plugins/clnrest
COPY --from=builder /opt/lightningd/plugins/clnrest/requirements.txt .
RUN pip3 install -r requirements.txt
RUN . /root/.venvs/cln/bin/activate && pip3 install -r requirements.txt

WORKDIR /opt/lightningd/plugins/wss-proxy
COPY --from=builder /opt/lightningd/plugins/wss-proxy/requirements.txt .
RUN pip3 install -r requirements.txt
RUN . /root/.venvs/cln/bin/activate && pip3 install -r requirements.txt
RUN pip3 cache purge

WORKDIR /opt/lightningd
Expand Down Expand Up @@ -323,7 +323,7 @@ RUN --mount=type=bind,from=builder,source=/var/libpq,target=/var/libpq,rw \
ldconfig

COPY --from=builder /tmp/lightning_install/ /usr/local/
COPY --from=builder-python /usr/local/lib/python3.11/dist-packages/ /usr/local/lib/python3.11/dist-packages/
COPY --from=builder-python /root/.venvs/cln/lib/python3.11/site-packages /usr/local/lib/python3.11/dist-packages/
COPY --from=downloader /opt/bitcoin/bin /usr/bin
COPY --from=downloader /opt/litecoin/bin /usr/bin
COPY tools/docker-entrypoint.sh entrypoint.sh
Expand Down

0 comments on commit 5f5ae0a

Please sign in to comment.