From fbf508e29b338604ff8f8ba7566dad7675f3807a Mon Sep 17 00:00:00 2001 From: Gaspard Wierzbinski Date: Mon, 11 Mar 2024 21:15:30 -1000 Subject: [PATCH] Create Dockerfile --- Dockerfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6f7eac0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Use the latest Postgres Docker image based on Alpine +FROM postgres:16-alpine + +# Set working directory +WORKDIR /usr/src/app + +# Install curl +RUN apk add --no-cache curl + +RUN cd "$(mktemp -d)" \ + && curl -LO "https://github.com/fboulnois/pg_uuidv7/releases/download/v1.3.0/{pg_uuidv7.tar.gz,SHA256SUMS}" \ + && tar xf pg_uuidv7.tar.gz \ + && sha256sum -c SHA256SUMS \ + && PG_MAJOR=$(pg_config --version | sed 's/^.* \([0-9]\{1,\}\).*$/\1/') \ + && cp "$PG_MAJOR/pg_uuidv7.so" "$(pg_config --pkglibdir)" \ + && cp sql/pg_uuidv7--1.3.sql pg_uuidv7.control "$(pg_config --sharedir)/extension" +# Add a script to run the CREATE EXTENSION command +RUN echo '#!/bin/sh\npsql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_uuidv7;"' > /docker-entrypoint-initdb.d/init.sh + +# Make the entrypoint script executable +RUN chmod +x /docker-entrypoint-initdb.d/init.sh