diff --git a/.gitignore b/.gitignore index d4c5593..4ce1895 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ Cargo.lock bin/ pkg/ wasm-pack.log +out/ + diff --git a/10_accumulo_access.sh b/10_accumulo_access.sh new file mode 100644 index 0000000..d0e7a7a --- /dev/null +++ b/10_accumulo_access.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +# Perform all actions as $POSTGRES_USER +export PGUSER="$POSTGRES_USER" + +# Create the 'template_accumulo_access' template db +"${psql[@]}" <<- 'EOSQL' +CREATE DATABASE template_accumulo_access IS_TEMPLATE true; +EOSQL + +# Load accumulo_access_pg into both template_database and $POSTGRES_DB +for DB in template_accumulo_access "$POSTGRES_DB"; do + echo "Loading accumulo_access_pg extension into $DB" + "${psql[@]}" --dbname="$DB" <<-'EOSQL' + CREATE EXTENSION IF NOT EXISTS accumulo_access_pg; +EOSQL +done diff --git a/Dockerfile b/Dockerfile.build similarity index 90% rename from Dockerfile rename to Dockerfile.build index c6fb853..74c4d9f 100644 --- a/Dockerfile +++ b/Dockerfile.build @@ -45,8 +45,5 @@ RUN cd target/artifacts/accumulo_access_pg-pg15 && \ -a amd64 \ . -FROM postgis/postgis:15-3.4 AS runtime - -COPY --from=build /tmp/accumulo_access_bullseye_pg15_0.1.0_amd64.deb /tmp/ -ADD 10_postgis.sh /docker-entrypoint-initdb.d/ -RUN apt install -y /tmp/accumulo_access_bullseye_pg15_0.1.0_amd64.deb +FROM scratch +COPY --from=build /tmp/accumulo_access_bullseye_pg15_0.1.0_amd64.deb / diff --git a/Dockerfile.postgis b/Dockerfile.postgis new file mode 100644 index 0000000..2cb2137 --- /dev/null +++ b/Dockerfile.postgis @@ -0,0 +1,11 @@ +FROM postgis/postgis:15-3.4 AS runtime + +LABEL maintainer="Lars Wilhelmsen " \ + org.opencontainers.image.description=" PostgreSQL 15 bullseye with accumulo_access_pg database extension" \ + org.opencontainers.image.source="https://github.com/larsw/accumulo_access_pg" + +ADD out/accumulo_access_bullseye_pg15_0.1.0_amd64.deb /tmp/ +RUN apt install -y /tmp/accumulo_access_bullseye_pg15_0.1.0_amd64.deb +# Overwrite the file provided by PostGIS with one that includes accumulo_access_pg +ADD 10_postgis.sh /docker-entrypoint-initdb.d/ + diff --git a/Dockerfile.postgres b/Dockerfile.postgres new file mode 100644 index 0000000..f9b7bfb --- /dev/null +++ b/Dockerfile.postgres @@ -0,0 +1,9 @@ +FROM postgis/postgis:15-3.4 AS runtime + +LABEL maintainer="Lars Wilhelmsen " \ + org.opencontainers.image.description="PostGIS 3.4.2+dfsg-1.pgdg110+1 spatial database extension AND accumulo_access_pg with PostgreSQL 15 bullseye" \ + org.opencontainers.image.source="https://github.com/larsw/accumulo_access_pg" + +ADD out/accumulo_access_bullseye_pg15_0.1.0_amd64.deb /tmp/ +RUN mkdir -p /docker-entrypoint-initdb.d && apt install -y /tmp/accumulo_access_bullseye_pg15_0.1.0_amd64.deb +ADD 10_accumulo_access.sh /docker-entrypoint-initdb.d/ diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b8a09fc --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +docker build -f Dockerfile.build -o out . +docker build -f Dockerfile.postgres -t larsw/postgres-accumulo-access:15.6-bullseye . +docker tag larsw/postgres-accumulo-access:15.6-bullseye larsw/postgres-accumulo-access:latest +docker build -f Dockerfile.postgis -t larsw/postgis-accumulo-access:15-3.4 . +docker tag larsw/postgis-accumulo-access:15-3.4 larsw/postgis-accumulo-access:latest