Skip to content

Commit

Permalink
Merge pull request #499 from GoogleCloudPlatform/rollback_alpine
Browse files Browse the repository at this point in the history
rollback alpine image to version 3.19
  • Loading branch information
anindyatahsin authored Dec 17, 2024
2 parents 55a973e + c56db60 commit 900f60c
Showing 1 changed file with 7 additions and 47 deletions.
54 changes: 7 additions & 47 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,70 +1,30 @@
FROM docker:27.3.1 as static-docker-source

FROM alpine:3.20 as build_image
# install python 3.11
RUN apk --no-cache upgrade && apk --no-cache add \
curl \
openssl-dev \
zlib-dev \
gcc \
g++ \
make \
sqlite-dev \
readline-dev \
libffi-dev \
&& rm -rf /var/cache/apk/* \
&& curl -O https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz \
&& tar -xzf Python-3.11.9.tgz \
&& cd Python-3.11.9 \
&& ./configure --enable-optimizations \
&& make -j$(nproc) \
&& make altinstall \
# && python3 --version \
&& python3.11 --version \
&& ln -sf /usr/local/bin/python3.11 /usr/bin/python3 \
&& rm -rf Python-3.11.9 \
&& rm -rf Python-3.11.9.tgz
RUN python3 --version && \
python3 -m ensurepip --upgrade && \
python3 -m pip install crcmod && \
# apk add --no-cache musl-dev rust cargo && \
python3 -m pip install pyOpenSSL && \
python3 -m pip install cryptography && \
rm -rf /root/.cache/pip && \
find / -name '*.pyc' -delete && \
find / -name '*__pycache__*' -exec rm -r {} \+

FROM alpine:3.20
FROM alpine:3.19
ARG CLOUD_SDK_VERSION
ENV CLOUD_SDK_VERSION=$CLOUD_SDK_VERSION
ENV PATH /google-cloud-sdk/bin:$PATH
COPY --from=static-docker-source /usr/local/bin/docker /usr/local/bin/docker
COPY --from=static-docker-source /usr/local/libexec/docker/cli-plugins/docker-buildx /usr/local/libexec/docker/cli-plugins/docker-buildx
COPY --from=build_image /usr/local/lib/python3.11 /usr/local/lib/python3.11
COPY --from=build_image /usr/bin/python3 /usr/bin/python3
RUN addgroup -g 1000 -S cloudsdk && \
adduser -u 1000 -S cloudsdk -G cloudsdk
RUN if [ `uname -m` = 'x86_64' ]; then echo -n "x86_64" > /tmp/arch; else echo -n "arm" > /tmp/arch; fi;
RUN export CLOUDSDK_PYTHON=/usr/local/bin/python3.11
RUN ARCH=`cat /tmp/arch` && apk --no-cache upgrade && apk --no-cache add \
curl \
bash \
python3 \
py3-crcmod \
py3-openssl \
bash \
libc6-compat \
openssh-client \
git \
gnupg \
gnupg \
&& curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${CLOUD_SDK_VERSION}-linux-${ARCH}.tar.gz && \
tar xzf google-cloud-cli-${CLOUD_SDK_VERSION}-linux-${ARCH}.tar.gz && \
rm google-cloud-cli-${CLOUD_SDK_VERSION}-linux-${ARCH}.tar.gz && \
gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true && \
gcloud config set metrics/environment docker_image_alpine && \
gcloud --version && \
rm -rf /root/.cache/pip && \
find / -name '*.pyc' -delete && \
find / -name '*__pycache__*' -exec rm -r {} \+
#python3.12 --version

gcloud --version
RUN git config --system credential.'https://source.developers.google.com'.helper gcloud.sh
VOLUME ["/root/.config"]

0 comments on commit 900f60c

Please sign in to comment.