From 7557fef1ee2ca44ad75362aa42a58e0716d9bd54 Mon Sep 17 00:00:00 2001 From: dappnodedev Date: Wed, 22 Nov 2023 18:33:20 +0100 Subject: [PATCH] FIx postgres user --- postgres/Dockerfile | 8 +++----- postgres/rename_files.sh | 15 --------------- 2 files changed, 3 insertions(+), 20 deletions(-) delete mode 100755 postgres/rename_files.sh diff --git a/postgres/Dockerfile b/postgres/Dockerfile index f5e7012..47d3735 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -16,7 +16,7 @@ RUN wget -q https://github.com/ConsenSys/web3signer/archive/refs/tags/${UPSTREAM ############ # POSTGRES # ############ -FROM postgres:14.1-alpine3.15 +FROM postgres:14.1-bullseye ARG UPSTREAM_VERSION @@ -26,12 +26,10 @@ ENV POSTGRES_PASSWORD=gnosis \ POSTGRES_DB=web3signer-gnosis \ INITDB_DIR=/docker-entrypoint-initdb.d/ -COPY rename_files.sh /usr/local/bin/rename_files.sh +RUN apt update && apt install -y rename COPY --from=postgres-migrations /usr/src/app/web3signer-${UPSTREAM_VERSION}/slashing-protection/src/main/resources/migrations/postgresql/* ${INITDB_DIR} -RUN /usr/local/bin/rename_files.sh - -USER postgres +RUN rename 's/(\d+)(?=.*\.)/sprintf("%03d",$1)/eg' /docker-entrypoint-initdb.d/* CMD ["postgres"] \ No newline at end of file diff --git a/postgres/rename_files.sh b/postgres/rename_files.sh deleted file mode 100755 index 419eac1..0000000 --- a/postgres/rename_files.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Loop over each file in the /docker-entrypoint-initdb.d directory -for file in ${INITDB_DIR}*; do - # Extract the base name and directory of the file - dir=$(dirname "$file") - base=$(basename "$file") - - # Use sed to modify the file name - # This will pad the first number in the file name with zeros to make it three digits long - new_base=$(echo "$base" | sed -r 's/([0-9]+)/000\1/g; s/0*([0-9]{3})/\1/g') - - # Move (rename) the file to its new name - mv "$dir/$base" "$dir/$new_base" -done