From c8aa91e78c8d360c83666c58e17b2548e10b09d8 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 25 Jun 2024 15:20:00 +0530 Subject: [PATCH] fix base docker files --- aio/Dockerfile-full-base | 28 +++++----------------------- aio/Dockerfile-slim-base | 28 +++++----------------------- 2 files changed, 10 insertions(+), 46 deletions(-) diff --git a/aio/Dockerfile-full-base b/aio/Dockerfile-full-base index 14d847f7112..01cca62aeec 100644 --- a/aio/Dockerfile-full-base +++ b/aio/Dockerfile-full-base @@ -1,6 +1,6 @@ FROM --platform=$BUILDPLATFORM tonistiigi/binfmt AS binfmt -FROM debian:12-slim +FROM python:3.12-slim # Set environment variables to non-interactive for apt ENV DEBIAN_FRONTEND=noninteractive @@ -13,7 +13,8 @@ RUN apt-get update && \ gnupg2 curl ca-certificates lsb-release software-properties-common \ 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 supervisor nginx nano vim ncdu + tk-dev libffi-dev liblzma-dev supervisor nginx nano vim ncdu \ + sudo lsof net-tools libpq-dev procps gettext # Install Redis 7.2 RUN echo "deb http://deb.debian.org/debian $(lsb_release -cs)-backports main" > /etc/apt/sources.list.d/backports.list && \ @@ -47,23 +48,11 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y nodejs -# Install Python 3.12 from source -RUN cd /usr/src && \ - wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz && \ - tar xzf Python-3.12.0.tgz && \ - cd Python-3.12.0 && \ - ./configure --enable-optimizations && \ - make altinstall && \ - rm -f /usr/src/Python-3.12.0.tgz - -RUN python3.12 -m pip install --upgrade pip - -RUN echo "alias python=/usr/local/bin/python3.12" >> ~/.bashrc && \ - echo "alias pip=/usr/local/bin/pip3.12" >> ~/.bashrc +RUN python -m pip install --upgrade pip # Clean up RUN apt-get clean && \ - rm -rf /var/lib/apt/lists/* /usr/src/Python-3.12.0 + rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -75,16 +64,9 @@ RUN mkdir -p /app/{data,logs} && \ # Create Supervisor configuration file COPY supervisord-full-base /app/supervisord.conf -RUN apt-get update && \ - apt-get install -y sudo lsof net-tools libpq-dev procps gettext && \ - apt-get clean - RUN sudo -u postgres /usr/lib/postgresql/$POSTGRES_VERSION/bin/initdb -D /var/lib/postgresql/data COPY postgresql.conf /etc/postgresql/postgresql.conf -RUN echo "alias python=/usr/local/bin/python3.12" >> ~/.bashrc && \ - echo "alias pip=/usr/local/bin/pip3.12" >> ~/.bashrc - # Expose ports for Redis, PostgreSQL, and MinIO EXPOSE 6379 5432 9000 80 443 diff --git a/aio/Dockerfile-slim-base b/aio/Dockerfile-slim-base index 9d17a3487fe..936c5f0d32e 100644 --- a/aio/Dockerfile-slim-base +++ b/aio/Dockerfile-slim-base @@ -1,6 +1,6 @@ FROM --platform=$BUILDPLATFORM tonistiigi/binfmt AS binfmt -FROM debian:12-slim +FROM python:3.12-slim # Set environment variables to non-interactive for apt ENV DEBIAN_FRONTEND=noninteractive @@ -13,29 +13,18 @@ RUN apt-get update && \ gnupg2 curl ca-certificates lsb-release software-properties-common \ 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 supervisor nginx nano vim ncdu + tk-dev libffi-dev liblzma-dev supervisor nginx nano vim ncdu \ + sudo lsof net-tools libpq-dev procps gettext # Install Node.js 18 RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y nodejs -# Install Python 3.12 from source -RUN cd /usr/src && \ - wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz && \ - tar xzf Python-3.12.0.tgz && \ - cd Python-3.12.0 && \ - ./configure --enable-optimizations && \ - make altinstall && \ - rm -f /usr/src/Python-3.12.0.tgz +RUN python -m pip install --upgrade pip -RUN python3.12 -m pip install --upgrade pip - -RUN echo "alias python=/usr/local/bin/python3.12" >> ~/.bashrc && \ - echo "alias pip=/usr/local/bin/pip3.12" >> ~/.bashrc - # Clean up RUN apt-get clean && \ - rm -rf /var/lib/apt/lists/* /usr/src/Python-3.12.0 + rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -47,13 +36,6 @@ RUN mkdir -p /app/{data,logs} && \ # Create Supervisor configuration file COPY supervisord-slim-base /app/supervisord.conf -RUN apt-get update && \ - apt-get install -y sudo lsof net-tools libpq-dev procps gettext && \ - apt-get clean - -RUN echo "alias python=/usr/local/bin/python3.12" >> ~/.bashrc && \ - echo "alias pip=/usr/local/bin/pip3.12" >> ~/.bashrc - # Expose ports for Redis, PostgreSQL, and MinIO EXPOSE 80 443