Skip to content

Commit 851415c

Browse files
authored
fix: pip, black, setuptools, twine, wheel, and aws-sam-cli incorrectly installed in superchain (#4201)
The packages were installed in a virtual environment, which is not subsequently re-activated in the image's ENTRYPOINT. Instead, install the packages 'globally'
1 parent ed667c7 commit 851415c

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

superchain/Dockerfile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ ENV LANG="C.UTF-8"
125125
RUN apt-get update \
126126
&& apt-get -y upgrade \
127127
&& apt-get -y install --no-install-recommends \
128+
acl \
128129
apt-transport-https \
129130
build-essential \
130131
ca-certificates \
@@ -133,15 +134,24 @@ RUN apt-get update
133134
git \
134135
gnupg \
135136
gzip \
137+
libbz2-dev \
136138
libffi-dev \
137139
libicu-dev \
140+
liblzma-dev \
141+
libncursesw5-dev \
142+
libreadline-dev \
143+
libsqlite3-dev \
138144
libssl-dev \
145+
libxml2-dev \
146+
libxmlsec1-dev \
139147
openssl \
140148
rsync \
141149
sudo \
150+
tk-dev \
142151
unzip \
152+
xz-utils \
143153
zip \
144-
acl \
154+
zlib1g-dev \
145155
&& rm -rf /var/lib/apt/lists/*
146156

147157
# Install mono
@@ -164,10 +174,12 @@ RUN set -eo pipefail
164174
ENV PATH=$PATH:${CARGO_HOME}/bin
165175

166176
# Install Python 3
167-
RUN apt-get update \
168-
&& apt-get -y install python3 python3-dev python3-pip python3-venv \
169-
&& python3 -m venv .venv \
170-
&& source .venv/bin/activate \
177+
ENV PYENV_ROOT="/opt/pyenv"
178+
RUN curl -fSsL "https://pyenv.run" | bash \
179+
&& command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" \
180+
&& eval "$(pyenv init -)" \
181+
&& PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto' pyenv install 3.8 \
182+
&& pyenv global 3.8 \
171183
&& python3 -m pip install --no-input --upgrade pip \
172184
&& python3 -m pip install --no-input --upgrade black setuptools twine wheel aws-sam-cli \
173185
&& rm -rf $(pip cache dir) \
@@ -397,8 +409,10 @@ ENV LANG="C.UTF-8"
397409
\
398410
GOROOT="/opt/golang/go" \
399411
RUSTUP_HOME="/usr/local/rustup" \
400-
CARGO_HOME="/usr/local/cargo"
401-
ENV PATH="${PATH}:${CARGO_HOME}/bin:${GOROOT}/bin:${M2}"
412+
CARGO_HOME="/usr/local/cargo" \
413+
\
414+
PYENV_ROOT="/opt/pyenv"
415+
ENV PATH="${PYENV_ROOT}/shims:${PATH}:${CARGO_HOME}/bin:${GOROOT}/bin:${M2}:${PYENV_ROOT}/bin"
402416

403417
COPY --from=staging / /
404418
VOLUME /var/lib/docker

superchain/build-local.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,17 @@ if [[ "${PLATFORM}" == "x86_64" ]]; then
2424
PLATFORM="amd64"
2525
fi
2626

27+
if command -v docker >/dev/null; then
28+
DOCKER=docker
29+
elif command -v finch >/dev/null; then
30+
DOCKER=finch
31+
else
32+
echo "Could not find 'docker' or 'finch' in PATH, aborting..."
33+
exit 1
34+
fi
35+
2736
# Now on to building the image
28-
${DOCKER:-docker} build \
37+
${DOCKER} build \
2938
--target superchain \
3039
--build-arg BUILDPLATFORM=linux/${PLATFORM} \
3140
--build-arg TARGETPLATFORM=linux/${PLATFORM} \

0 commit comments

Comments
 (0)