File tree Expand file tree Collapse file tree 5 files changed +62
-9
lines changed Expand file tree Collapse file tree 5 files changed +62
-9
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,21 @@ FROM senzing/senzingsdk-tools:4.0.0
22
33USER root
44
5+ # Add the PostgreSQL APT repository.
6+ RUN echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
7+ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
8+
59# Update packages and install additional dependencies.
610RUN apt-get update && \
711 apt-get upgrade -y && \
8- apt-get install --no-install-recommends -y awscli pipx && \
12+ apt-get install --no-install-recommends -y awscli pipx postgresql-client senzingsdk-poc && \
913 apt-get autoremove \
1014 && apt-get clean
1115
16+ # Copy entrypoint scripts.
17+ COPY docker/entrypoint.sh /entrypoint.sh
18+ COPY docker/entrypoint.d /entrypoint.d
19+
1220# Add a new user and switch to it.
1321RUN useradd -m -u 1001 senzing
1422USER senzing
@@ -17,4 +25,8 @@ USER senzing
1725ENV PATH="$PATH:/home/senzing/.local/bin"
1826RUN pipx install awscli-local
1927
28+ # Define volumes necessary to support a read-only root filesystem.
29+ VOLUME ["/home/senzing", "/var/lib/amazon", "/var/log"]
30+
2031WORKDIR /home/senzing
32+ ENTRYPOINT ["/entrypoint.sh"]
Original file line number Diff line number Diff line change 11services :
22 db :
3- image : bitnamisecure/postgresql:latest
3+ image : postgres:17.6
44 environment :
5- # See https://github.com/bitnami/bitnami-docker-postgresql#configuration
6- POSTGRESQL_DATABASE : ${POSTGRES_DB:-G2}
7- POSTGRESQL_PASSWORD : ${POSTGRES_PASSWORD:-senzing}
8- POSTGRESQL_POSTGRES_PASSWORD : ${POSTGRESQL_POSTGRES_PASSWORD:-postgres}
9- POSTGRESQL_USERNAME : ${POSTGRES_USERNAME:-senzing}
5+ # See https://hub.docker.com/_/postgres
6+ # POSTGRES_DB: ${POSTGRES_DB:-G2}
7+ POSTGRES_PASSWORD : ${POSTGRES_PASSWORD:-senzing}
8+ POSTGRES_USER : ${POSTGRES_USERNAME:-senzing}
109 healthcheck :
1110 test : [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USERNAME:-senzing}" ]
1211 interval : 10s
1312 timeout : 5s
1413 retries : 5
1514 ports :
1615 - 5432:5432
17- user : " ${SENZING_UID:-504}:0"
1816 restart : always
1917 volumes :
20- - postgres:/bitnami/ postgresql
18+ - postgres:/var/lib/ postgresql/data
2119
2220 init-db :
2321 image : senzing/init-database:latest
@@ -61,6 +59,10 @@ services:
6159 - db
6260 environment :
6361 AWS_ENDPOINT_URL : http://localstack:4566
62+ PGHOST : db
63+ PGUSER : ${POSTGRES_USERNAME:-senzing}
64+ PGPASSWORD : ${POSTGRES_PASSWORD:-senzing}
65+ SENZING_DATASOURCES : PEOPLE CUSTOMERS
6466 SENZING_ENGINE_CONFIGURATION_JSON : >-
6567 {
6668 "PIPELINE": {
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if psql -lqt | cut -d \| -f 1 | grep -qw G2; then
4+ echo " Database has already been initialized"
5+ else
6+ echo " Initializing Senzing database"
7+ createdb G2
8+ psql -d G2 -f /opt/senzing/er/resources/schema/szcore-schema-postgresql-create.sql
9+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [[ -n " ${SENZING_DATASOURCES} " ]]; then
4+ echo " Creating data sources"
5+ > /home/senzing/data-sources.txt
6+
7+ IFS=" " read -r -a data_sources <<< " $SENZING_DATASOURCES"
8+ for ds in " ${data_sources[@]} " ; do
9+ echo " addDataSource ${ds} " >> /home/senzing/data-sources.txt
10+ done
11+
12+ echo " save" >> /home/senzing/data-sources.txt
13+ sz_configtool -f /home/senzing/data-sources.txt
14+ rm /home/senzing/data-sources.txt
15+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Execute scripts in /entrypoint.d/
4+ for f in /entrypoint.d/* ; do
5+ case " $f " in
6+ * .sh) echo " $0 : running $f " ; . " $f " ;;
7+ * ) echo " $0 : ignoring $f " ;;
8+ esac
9+ echo
10+ done
11+
12+ # Execute the main command passed to the script.
13+ echo " Running as user: $( whoami) "
14+ echo " Executing command: $@ "
15+ exec " $@ "
You can’t perform that action at this time.
0 commit comments