Merge pull request #1048 from PeterDaveHelloKitchen/Dockerfile

Optimize Dockerfile to reduce image size and improve build efficiency
This commit is contained in:
Alex
2024-08-01 17:16:59 +01:00
committed by GitHub

View File

@@ -4,14 +4,11 @@ FROM ubuntu:24.04 as builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
apt-get install -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
# Install necessary packages and Python
RUN apt-get update && \
apt-get update && \
apt-get install -y --no-install-recommends gcc wget unzip libc6-dev python3.11 python3.11-distutils python3.11-venv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Verify Python installation and setup symlink
@@ -50,12 +47,10 @@ RUN pip install --no-cache-dir --upgrade pip && \
FROM ubuntu:24.04 as final
RUN apt-get update && \
apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
apt-get install -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
# Install Python
RUN apt-get update && apt-get install -y --no-install-recommends python3.11 && \
apt-get update && apt-get install -y --no-install-recommends python3.11 && \
ln -s /usr/bin/python3.11 /usr/bin/python && \
rm -rf /var/lib/apt/lists/*