Skip to content

Commit

Permalink
fix: pip, black, setuptools, twine, wheel, and aws-sam-cli incorrectl…
Browse files Browse the repository at this point in the history
…y 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'
  • Loading branch information
RomainMuller committed Aug 2, 2023
1 parent ed667c7 commit 851415c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
28 changes: 21 additions & 7 deletions superchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ ENV LANG="C.UTF-8"
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install --no-install-recommends \
acl \
apt-transport-https \
build-essential \
ca-certificates \
Expand All @@ -133,15 +134,24 @@ RUN apt-get update
git \
gnupg \
gzip \
libbz2-dev \
libffi-dev \
libicu-dev \
liblzma-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxmlsec1-dev \
openssl \
rsync \
sudo \
tk-dev \
unzip \
xz-utils \
zip \
acl \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

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

# Install Python 3
RUN apt-get update \
&& apt-get -y install python3 python3-dev python3-pip python3-venv \
&& python3 -m venv .venv \
&& source .venv/bin/activate \
ENV PYENV_ROOT="/opt/pyenv"
RUN curl -fSsL "https://pyenv.run" | bash \
&& command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" \
&& eval "$(pyenv init -)" \
&& PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto' pyenv install 3.8 \
&& pyenv global 3.8 \
&& python3 -m pip install --no-input --upgrade pip \
&& python3 -m pip install --no-input --upgrade black setuptools twine wheel aws-sam-cli \
&& rm -rf $(pip cache dir) \
Expand Down Expand Up @@ -397,8 +409,10 @@ ENV LANG="C.UTF-8"
\
GOROOT="/opt/golang/go" \
RUSTUP_HOME="/usr/local/rustup" \
CARGO_HOME="/usr/local/cargo"
ENV PATH="${PATH}:${CARGO_HOME}/bin:${GOROOT}/bin:${M2}"
CARGO_HOME="/usr/local/cargo" \
\
PYENV_ROOT="/opt/pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PATH}:${CARGO_HOME}/bin:${GOROOT}/bin:${M2}:${PYENV_ROOT}/bin"

COPY --from=staging / /
VOLUME /var/lib/docker
Expand Down
11 changes: 10 additions & 1 deletion superchain/build-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ if [[ "${PLATFORM}" == "x86_64" ]]; then
PLATFORM="amd64"
fi

if command -v docker >/dev/null; then
DOCKER=docker
elif command -v finch >/dev/null; then
DOCKER=finch
else
echo "Could not find 'docker' or 'finch' in PATH, aborting..."
exit 1
fi

# Now on to building the image
${DOCKER:-docker} build \
${DOCKER} build \
--target superchain \
--build-arg BUILDPLATFORM=linux/${PLATFORM} \
--build-arg TARGETPLATFORM=linux/${PLATFORM} \
Expand Down

0 comments on commit 851415c

Please sign in to comment.