From df9a2d8376a66d5445fca7d67910496f100d3971 Mon Sep 17 00:00:00 2001 From: jefer94 Date: Thu, 5 Sep 2024 17:43:32 -0500 Subject: [PATCH] update dockerfile --- .gitpod.Dockerfile | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index bb31409b7..e9324c1cd 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -2,6 +2,9 @@ FROM gitpod/workspace-postgres:latest SHELL ["/bin/bash", "-c"] +RUN sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' \ + && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + # Add LLVM repository and key RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \ && echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list @@ -11,21 +14,29 @@ RUN sudo apt-get update \ && sudo apt-get clean \ && sudo rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/* - - -# That Gitpod install pyenv for me? no, thanks -# WORKDIR /home/gitpod/ -# RUN rm .pyenv -Rf -# RUN rm .gp_pyenv.d -Rf -# RUN curl https://pyenv.run | bash - +# RUN sudo update-alternatives --set postgresql /usr/lib/postgresql/16/bin/postgres # RUN pyenv update && pyenv install 3.12.3 && pyenv global 3.12.3 RUN pyenv install 3.12.3 && pyenv global 3.12.3 -RUN pip install pipenv yapf +RUN pip install pipenv + +# Set up PostgreSQL 16 +USER postgres +RUN /usr/lib/postgresql/16/bin/initdb -D /var/lib/postgresql/16/data +RUN echo "host all all all md5" >> /var/lib/postgresql/16/data/pg_hba.conf +RUN echo "listen_addresses='*'" >> /var/lib/postgresql/16/data/postgresql.conf +RUN /usr/lib/postgresql/16/bin/pg_ctl -D /var/lib/postgresql/16/data start && \ + /usr/lib/postgresql/16/bin/psql -c "CREATE USER gitpod WITH PASSWORD 'gitpod';" && \ + /usr/lib/postgresql/16/bin/psql -c "ALTER USER gitpod WITH SUPERUSER;" && \ + /usr/lib/postgresql/16/bin/psql -c "CREATE DATABASE gitpod OWNER gitpod;" && \ + /usr/lib/postgresql/16/bin/pg_ctl -D /var/lib/postgresql/16/data stop # remove PIP_USER environment USER gitpod + +# Ensure PostgreSQL 16 is used +RUN echo "export PATH=/usr/lib/postgresql/16/bin:$PATH" >> /home/gitpod/.bashrc + RUN if ! grep -q "export PIP_USER=no" "$HOME/.bashrc"; then printf '%s\n' "export PIP_USER=no" >> "$HOME/.bashrc"; fi RUN echo "" >> $HOME/.bashrc RUN echo "unset DATABASE_URL" >> $HOME/.bashrc