From 004595dcedd1506469c494e0335910dfb71aac87 Mon Sep 17 00:00:00 2001 From: samrose Date: Tue, 29 Oct 2024 00:12:01 -0400 Subject: [PATCH] fix: needs git in buildInputs too (#1301) * fix: needs git in buildInputs too * fix: git on inputs in func * fix: should be remove git * fix: add git to dockerfile for clickhouse dep * fix: non interactive tzdata * fix: try to make timezone intall noninteractive * fix: cleanup package installs --------- Co-authored-by: Sam Rose --- Dockerfile-15 | 22 ++++++++++++++-------- Dockerfile-16 | 23 ++++++++++++++--------- ansible/tasks/stage2-setup-postgres.yml | 7 ++++--- nix/ext/wrappers/default.nix | 3 ++- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/Dockerfile-15 b/Dockerfile-15 index ce83237f2..01895db39 100644 --- a/Dockerfile-15 +++ b/Dockerfile-15 @@ -41,14 +41,26 @@ ARG wal_g_release=2.0.1 FROM ubuntu:focal as base -RUN apt update -y && apt install -y \ + +ENV DEBIAN_FRONTEND=noninteractive \ + DEBCONF_NONINTERACTIVE_SEEN=true \ + TZ=Etc/UTC + +# Pre-configure tzdata before any installations +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ + echo $TZ > /etc/timezone && \ + apt-get update && \ + apt-get install -y --no-install-recommends tzdata && \ + apt-get install -y \ curl \ gnupg \ lsb-release \ software-properties-common \ wget \ sudo \ - && apt clean + git \ + && apt clean && \ + rm -rf /var/lib/apt/lists/* RUN adduser --system --home /var/lib/postgresql --no-create-home --shell /bin/bash --group --gecos "PostgreSQL administrator" postgres @@ -102,12 +114,6 @@ RUN chown -R postgres:postgres /usr/lib/postgresql RUN ln -sf /usr/lib/postgresql/share/postgresql/timezonesets /usr/share/postgresql/timezonesets -RUN apt-get update && \ - apt-get install -y --no-install-recommends tzdata - -RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ - dpkg-reconfigure --frontend noninteractive tzdata - RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ diff --git a/Dockerfile-16 b/Dockerfile-16 index db5772cee..c281ccd7f 100644 --- a/Dockerfile-16 +++ b/Dockerfile-16 @@ -41,14 +41,25 @@ ARG wal_g_release=2.0.1 FROM ubuntu:focal as base -RUN apt update -y && apt install -y \ +ENV DEBIAN_FRONTEND=noninteractive \ + DEBCONF_NONINTERACTIVE_SEEN=true \ + TZ=Etc/UTC + +# Pre-configure tzdata before any installations +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ + echo $TZ > /etc/timezone && \ + apt-get update && \ + apt-get install -y --no-install-recommends tzdata && \ + apt-get install -y \ curl \ gnupg \ lsb-release \ software-properties-common \ wget \ sudo \ - && apt clean + git \ + && apt clean && \ + rm -rf /var/lib/apt/lists/* RUN adduser --system --home /var/lib/postgresql --no-create-home --shell /bin/bash --group --gecos "PostgreSQL administrator" postgres @@ -101,13 +112,7 @@ RUN chown -R postgres:postgres /usr/lib/postgresql RUN ln -sf /usr/lib/postgresql/share/postgresql/timezonesets /usr/share/postgresql/timezonesets - -RUN apt-get update && \ - apt-get install -y --no-install-recommends tzdata - -RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ - dpkg-reconfigure --frontend noninteractive tzdata - + RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ diff --git a/ansible/tasks/stage2-setup-postgres.yml b/ansible/tasks/stage2-setup-postgres.yml index 3b8d9ad02..4e9003ace 100644 --- a/ansible/tasks/stage2-setup-postgres.yml +++ b/ansible/tasks/stage2-setup-postgres.yml @@ -43,12 +43,13 @@ sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#{{postgresql_version}}_src" when: stage2_nix -- name: Install Git for Nix package management +- name: Remove Git after Nix package installations become: yes apt: name: git - state: present - update_cache: yes + state: absent + autoremove: yes + purge: yes when: stage2_nix - name: Set ownership and permissions for /etc/ssl/private diff --git a/nix/ext/wrappers/default.nix b/nix/ext/wrappers/default.nix index 74b94f9f9..df44de35f 100644 --- a/nix/ext/wrappers/default.nix +++ b/nix/ext/wrappers/default.nix @@ -9,6 +9,7 @@ , darwin , jq , rust-bin +, git }: let rustVersion = "1.80.0"; @@ -29,7 +30,7 @@ buildPgrxExtension_0_12_6 rec { }; nativeBuildInputs = [ pkg-config cargo ]; - buildInputs = [ openssl postgresql ] ++ lib.optionals (stdenv.isDarwin) [ + buildInputs = [ openssl postgresql git ] ++ lib.optionals (stdenv.isDarwin) [ darwin.apple_sdk.frameworks.CoreFoundation darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.SystemConfiguration