[python] Refactor pycharm-tests Dockerfile

Small changes for better readability, layers organization and cleaner docker context

GitOrigin-RevId: 4dc6c7ecd4fca20de988b19fb322c90175379817
This commit is contained in:
Kseniia Iashina
2023-12-06 18:10:05 +01:00
committed by intellij-monorepo-bot
parent 3f25f3b934
commit ffbf481523
2 changed files with 21 additions and 13 deletions

View File

@@ -0,0 +1,2 @@
.gradle
build

View File

@@ -1,30 +1,36 @@
FROM debian:12 AS BUILDER
ARG BASE_IMAGE=debian:12
FROM $BASE_IMAGE AS BUILDER
LABEL maintainer="Andrey Lisin"
# Pythons will go here
ENV PYCHARM_PYTHONS=/pythons/
RUN apt-get update \
&& apt-get install -y curl gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget \
llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-pip default-jre-headless
RUN apt-get update && \
apt-get install -y curl gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget \
llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-pip default-jre-headless && \
rm -rf /var/lib/apt/lists/*
# Install conda to location known by ``suggestCondaPath`` to be found by test runner
RUN curl https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Linux-x86_64.sh > ./conda.sh
RUN bash ./conda.sh -b -p /opt/miniconda3/
ARG MINICONDA_INSTALLER="Miniconda3-py310_23.3.1-0-Linux-x86_64.sh"
ADD --chmod=544 https://repo.anaconda.com/miniconda/$MINICONDA_INSTALLER ./
RUN ./$MINICONDA_INSTALLER -b -p /opt/miniconda3/
ADD . .
RUN sh ./gradlew build
RUN ./gradlew build
############################
FROM debian:12 AS RUNNER
FROM $BASE_IMAGE AS RUNNER
# xterm installs freetype, xlib, cb etc. GL is also required by some python tests
RUN apt-get update && apt-get install -y openssl libgl1 xterm locales libsqlite3-dev
RUN apt-get update && apt-get install -y openssl libgl1 xterm locales libsqlite3-dev && \
rm -rf /var/lib/apt/lists/*
# UTF locale is required for testFileEncoding
# libsqlite3 is for Django
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
RUN locale-gen
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen
ENV LC_ALL en_US.UTF-8
ENV PYCHARM_PYTHONS=/pythons/
@@ -32,4 +38,4 @@ COPY --from=builder /pythons/ /pythons
COPY --from=builder /opt/miniconda3 /opt/miniconda3
# To make sure all pythons are executable
RUN find / -executable -type f,l -name "python" -print0 | xargs -0 -I '{}' sh -c "'{}' --version"
RUN find / -executable -type f,l -name "python" -print0 | xargs -0 -I '{}' sh -c "'{}' --version"