Commit a8c31e0 1 parent 6b0daeb commit a8c31e0 Copy full SHA for a8c31e0
File tree 1 file changed +24
-6
lines changed
1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change 1
- FROM postgres:16-alpine
1
+ FROM postgres:16-alpine AS env-build
2
2
3
- RUN apk update && apk add git build-base postgresql-dev
4
- RUN postgres --version
5
- RUN git clone https://github.com/fboulnois/pg_uuidv7
6
- RUN cd pg_uuidv7 && make && make install && ls -la
3
+ # install build dependencies
4
+ RUN apk update && apk upgrade \
5
+ && apk add build-base postgresql-dev
7
6
8
- COPY ./init.sql /docker-entrypoint-initdb.d/init.sql
7
+ WORKDIR /srv
8
+ COPY . /srv
9
+
10
+ # build extension for P16
11
+ RUN pg_buildext build-16 16
12
+
13
+ # create tarball and checksums
14
+ RUN cp sql/pg_uuidv7--1.5.sql . && TARGETS=$(find * -name pg_uuidv7.so) \
15
+ && tar -czvf pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.5.sql pg_uuidv7.control \
16
+ && sha256sum pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.5.sql pg_uuidv7.control > SHA256SUMS
17
+
18
+ FROM postgres:16-alpine AS env-deploy
19
+
20
+ # copy tarball and checksums
21
+ COPY --from=env-build /srv/pg_uuidv7.tar.gz /srv/SHA256SUMS /srv/
22
+
23
+ # add extension to postgres
24
+ COPY --from=env-build /srv/${PG_MAJOR}/pg_uuidv7.so /usr/lib/postgresql/${PG_MAJOR}/lib
25
+ COPY --from=env-build /srv/pg_uuidv7.control /usr/share/postgresql/${PG_MAJOR}/extension
26
+ COPY --from=env-build /srv/pg_uuidv7--1.5.sql /usr/share/postgresql/${PG_MAJOR}/extension
9
27
10
28
# Add a script to run the CREATE EXTENSION command
11
29
RUN printf '#!/bin/sh\n psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_uuidv7;"' > /docker-entrypoint-initdb.d/init.sh
You can’t perform that action at this time.
0 commit comments