Skip to content

Commit

Permalink
build: update Dockerfile to use Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
UsamaSadiq committed Jun 26, 2024
1 parent 35dd2d4 commit e591d35
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ FROM ubuntu:focal as base

# System requirements.

# ENV variables for Python 3.12 support
ARG PYTHON_VERSION=3.12
ENV TZ=UTC
ENV TERM=xterm-256color
ENV DEBIAN_FRONTEND=noninteractive

# software-properties-common is needed to setup Python 3.12 env
RUN apt-get update && \
apt-get install -y software-properties-common && \
apt-add-repository -y ppa:deadsnakes/ppa

# pkg-config; mysqlclient>=2.2.0 requires pkg-config (https://github.com/PyMySQL/mysqlclient/issues/620)

RUN apt update && \
Expand All @@ -10,14 +21,24 @@ RUN apt update && \
vim \
language-pack-en \
build-essential \
python3.8-dev \
python3-virtualenv \
python3.8-distutils \
libffi-dev \
libsqlite3-dev \
python3-pip \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python${PYTHON_VERSION}-distutils \
libmysqlclient-dev \
pkg-config \
libssl-dev && \
rm -rf /var/lib/apt/lists/*

# Set Zoneinfo settings for Python 3.12 support
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# need to use virtualenv pypi package with Python 3.12
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}
RUN pip install virtualenv

# Use UTF-8.
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
Expand All @@ -39,7 +60,7 @@ ENV ANALYTICS_API_CFG "/edx/etc/${ANALYTICS_API_SERVICE_NAME}.yml"
# Working directory will be root of repo.
WORKDIR ${ANALYTICS_API_CODE_DIR}

RUN virtualenv -p python3.8 --always-copy ${ANALYTICS_API_VENV_DIR}
RUN virtualenv -p python${PYTHON_VERSION} --always-copy ${ANALYTICS_API_VENV_DIR}

# Expose canonical Analytics port
EXPOSE 19001
Expand Down

0 comments on commit e591d35

Please sign in to comment.