Skip to content

Commit

Permalink
feat: install rust in bookworm -dev images (py3.11, py3.12)
Browse files Browse the repository at this point in the history
This is more and more required to build packages such as langchain, etc
(using AI). Bonsai Tiger for example is starting to use langchain and
too many dependendies complain about missing Rust, fixing manually all
of them would be too tiresome.
  • Loading branch information
derlin committed Oct 9, 2024
1 parent 94bfdd7 commit 02faaf4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
12 changes: 11 additions & 1 deletion py3.11-slim-bookworm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# hadolint global ignore=DL3059
FROM python:3.11.7-slim-bookworm AS build
FROM python:3.11.10-slim-bookworm AS build

ARG TARGET=prod
ARG TARGETARCH
Expand All @@ -13,6 +13,8 @@ ENV PYTHONUNBUFFERED=1 \
PROCFILE_PATH=/app/Procfile \
LC_ALL=C.UTF-8

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

RUN mkdir -p /usr/share/man/man1/ /usr/share/man/man7/

RUN apt-get update && apt-get upgrade -y
Expand Down Expand Up @@ -69,6 +71,14 @@ RUN if [ "$TARGET" = "dev" ] ; then apt-get install -y --no-install-recommends \
zlib1g-dev \
; fi

# In dev, install Rust as many packages use it behind the scenes
# (e.g. langchain, AI tools, etc.)
# hadolint ignore=SC2086
RUN if [ "$TARGET" = "dev" ] ; then \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; \
for i in $HOME/.cargo/bin/*; do ln -s "$i" "/usr/bin/$(basename $i)"; done \
fi

# Workaround for a bug in hub.docker.com
RUN ln -s -f /bin/true /usr/bin/chfn

Expand Down
13 changes: 12 additions & 1 deletion py3.12-slim-bookworm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# hadolint global ignore=DL3059
FROM python:3.12.1-slim-bookworm AS build
FROM python:3.12.7-slim-bookworm AS build

ARG TARGET=prod
ARG TARGETARCH
Expand All @@ -13,6 +13,8 @@ ENV PYTHONUNBUFFERED=1 \
PROCFILE_PATH=/app/Procfile \
LC_ALL=C.UTF-8

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

RUN mkdir -p /usr/share/man/man1/ /usr/share/man/man7/

RUN apt-get update && apt-get upgrade -y
Expand Down Expand Up @@ -69,6 +71,15 @@ RUN if [ "$TARGET" = "dev" ] ; then apt-get install -y --no-install-recommends \
zlib1g-dev \
; fi

# In dev, install Rust as many packages use it behind the scenes
# (e.g. langchain, AI tools, etc.)
# hadolint ignore=SC2086
RUN if [ "$TARGET" = "dev" ] ; then \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; \
for i in $HOME/.cargo/bin/*; do ln -s "$i" "/usr/bin/$(basename $i)"; done \
fi


# Workaround for a bug in hub.docker.com
RUN ln -s -f /bin/true /usr/bin/chfn

Expand Down

0 comments on commit 02faaf4

Please sign in to comment.