Remove dspace-postgres-pgcrypto. Rename dspace-postgres-pgcrypto-curl to dspace-postgres-loadsql

This commit is contained in:
Tim Donohue
2025-07-28 11:28:51 -05:00
parent 688af08b85
commit 86d2a0aa33
4 changed files with 7 additions and 63 deletions

View File

@@ -7,20 +7,22 @@
# #
# To build for example use: # To build for example use:
# docker build --build-arg POSTGRES_VERSION=13 --build-arg POSTGRES_PASSWORD=mypass ./dspace/src/main/docker/dspace-postgres-pgcrypto-curl/ # docker build --build-arg POSTGRES_VERSION=17 --build-arg POSTGRES_PASSWORD=mypass ./dspace/src/main/docker/dspace-postgres-curl/
# This will be published as dspace/dspace-postgres-pgcrypto:$DSPACE_VERSION-loadsql # This will be published as dspace/dspace-postgres-loadsql:$DSPACE_VERSION
ARG POSTGRES_VERSION=15 ARG POSTGRES_VERSION=15
ARG POSTGRES_DB=dspace
ARG POSTGRES_USER=dspace
ARG POSTGRES_PASSWORD=dspace ARG POSTGRES_PASSWORD=dspace
FROM docker.io/postgres:${POSTGRES_VERSION} FROM docker.io/postgres:${POSTGRES_VERSION}
ENV POSTGRES_DB=dspace ENV POSTGRES_DB=${POSTGRES_DB}
ENV POSTGRES_USER=dspace ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD} ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# Install curl which is necessary to load SQL file # Install curl which is necessary to load SQL file
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# Load a SQL dump. Set LOADSQL to a URL for the sql dump file. # Load a SQL dump. Set LOADSQL to a URL for the sql dump file.
COPY install-pgcrypto.sh /docker-entrypoint-initdb.d/ COPY loadsql.sh /docker-entrypoint-initdb.d/

View File

@@ -34,16 +34,3 @@ then
touch $CHECKFILE touch $CHECKFILE
fi fi
# Then, setup pgcrypto on this database
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
-- Create a new schema in this database named "extensions" (or whatever you want to name it)
CREATE SCHEMA IF NOT EXISTS extensions;
-- Enable this extension in this new schema
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions;
-- Update your database's "search_path" to also search the new "extensions" schema.
-- You are just appending it on the end of the existing comma-separated list.
ALTER DATABASE dspace SET search_path TO "\$user",public,extensions;
-- Grant rights to call functions in the extensions schema to your dspace user
GRANT USAGE ON SCHEMA extensions TO $POSTGRES_USER;
EOSQL

View File

@@ -1,23 +0,0 @@
#
# The contents of this file are subject to the license and copyright
# detailed in the LICENSE and NOTICE files at the root of the source
# tree and available online at
#
# http://www.dspace.org/license/
#
# To build for example use:
# docker build --build-arg POSTGRES_VERSION=13 --build-arg POSTGRES_PASSWORD=mypass ./dspace/src/main/docker/dspace-postgres-pgcrypto/
# This will be published as dspace/dspace-postgres-pgcrypto:$DSPACE_VERSION
ARG POSTGRES_VERSION=15
ARG POSTGRES_PASSWORD=dspace
FROM docker.io/postgres:${POSTGRES_VERSION}
ENV POSTGRES_DB=dspace
ENV POSTGRES_USER=dspace
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# Copy over script which will initialize database and install pgcrypto extension
COPY install-pgcrypto.sh /docker-entrypoint-initdb.d/

View File

@@ -1,22 +0,0 @@
#!/bin/bash
#
# The contents of this file are subject to the license and copyright
# detailed in the LICENSE and NOTICE files at the root of the source
# tree and available online at
#
# http://www.dspace.org/license/
#
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
-- Create a new schema in this database named "extensions" (or whatever you want to name it)
CREATE SCHEMA IF NOT EXISTS extensions;
-- Enable this extension in this new schema
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions;
-- Update your database's "search_path" to also search the new "extensions" schema.
-- You are just appending it on the end of the existing comma-separated list.
ALTER DATABASE dspace SET search_path TO "\$user",public,extensions;
-- Grant rights to call functions in the extensions schema to your dspace user
GRANT USAGE ON SCHEMA extensions TO $POSTGRES_USER;
EOSQL