FROM --platform=linux/amd64 ubuntu:22.04 as base
USER root
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV DEBIAN_FRONTEND noninteractive
COPY . /app
WORKDIR /app
COPY ZscalerRootCertificate-2048-SHA256.crt /usr/local/share/ca-certificates/ZscalerRootCertificate-2048-SHA256.crt
# Approach 1 to install Python
# RUN mkdir /python && cd /python && \
# wget https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tgz && \
# tar -zxvf Python-3.11.1.tgz && \
# cd Python-3.11.1 && \
# ls -lhR && \
# ./configure --enable-optimizations && \
# make install && \
# rm -rf /python
# Approach 1 end
# Approach 2 to install python
# Copy Python binaries from the GitHub Actions workflow
COPY Python /opt/Python
# Update PATH to include the copied Python binaries
ENV PATH="/opt/Python/3.11.1/x64/bin:/opt/Python/3.11.1/x64:${PATH}"
# Set the LD_LIBRARY_PATH to include the copied shared libraries
ENV LD_LIBRARY_PATH="/opt/python/lib:${LD_LIBRARY_PATH}"
# Fail soon than later, if python wasn't installed
RUN python --version
# Approach 2 end
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y software-properties-common ca-certificates && \
update-ca-certificates
RUN python -m pip install -U pip
RUN python3.11 -m pip install --no-cache-dir --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements/core-requirements.txt