diff --git a/docker-compose.yml b/docker-compose.yml index f758533..4151c34 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -173,8 +173,6 @@ services: dockerfile: ./pgadmin/Dockerfile args: - PGADMIN_TAG - depends_on: - - postgres restart: 'no' expose: - 80 diff --git a/pgadmin/Dockerfile b/pgadmin/Dockerfile index 7ad3adc..848ede4 100644 --- a/pgadmin/Dockerfile +++ b/pgadmin/Dockerfile @@ -15,9 +15,12 @@ USER root # Install bash RUN apk add --no-cache bash jq sqlite -# Conditionally copy the private key if it exists -COPY --chown=pgadmin:root ./pgadmin/private_key /pgadmin4/private_key -# Set permissions for the private key +# Check if the private key exists, copy it and set permissions if it does +RUN if [ -f ./pgadmin/private_key ]; then \ + cp ./pgadmin/private_key /pgadmin4/private_key && \ + chown pgadmin:root /pgadmin4/private_key && \ + chmod 600 /pgadmin4/private_key; \ + fi # Copy your script file into the Docker image COPY --chown=pgadmin:root ./.env / diff --git a/pgadmin/start_pgadmin.sh b/pgadmin/start_pgadmin.sh index 3a0d7fe..e8133b4 100755 --- a/pgadmin/start_pgadmin.sh +++ b/pgadmin/start_pgadmin.sh @@ -19,9 +19,6 @@ DIR_NAME="/var/lib/pgadmin/storage/${PGADMIN_DEFAULT_EMAIL//@/_}" # Create the directory using the modified name mkdir -p "$DIR_NAME" -cp /pgadmin4/private_key "$DIR_NAME/private_key" -chown -R pgadmin:root "$DIR_NAME/private_key" - # Generate JSON for each matching variable DB_PATH="/var/lib/pgadmin/pgadmin4.db" json_output="{\"Servers\":{"