kubesphere / s2i-python-container

Apache License 2.0
5 stars 5 forks source link

python-ubuntu #20

Open xiexinmofo opened 1 year ago

xiexinmofo commented 1 year ago

Can provide an image based on Python 3.8+ubuntu ?

owenwu811 commented 1 year ago

FROM ubuntu:latest

Update package lists and install required dependencies

RUN apt-get update && apt-get install -y \ python3.8 \ python3-pip

Set the default Python version

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

Set the working directory in the container

WORKDIR /app

Copy the requirements file into the container

COPY requirements.txt .

Install Python dependencies

RUN pip3 install --no-cache-dir -r requirements.txt

Copy the application code into the container

COPY . .

Set the entry point for the container

CMD [ "python3", "app.py" ]