mirror of
https://github.com/versia-pub/postgres.git
synced 2025-12-06 15:08:18 +01:00
Update Dockerfile
This commit is contained in:
parent
a8c31e0872
commit
a528966983
30
Dockerfile
30
Dockerfile
|
|
@ -1,29 +1,9 @@
|
||||||
FROM postgres:16-alpine AS env-build
|
FROM postgres:16
|
||||||
|
|
||||||
# install build dependencies
|
RUN apt-get update && apt-get -y install git build-essential postgresql-server-dev-16
|
||||||
RUN apk update && apk upgrade \
|
RUN postgres --version
|
||||||
&& apk add build-base postgresql-dev
|
RUN git clone https://github.com/fboulnois/pg_uuidv7
|
||||||
|
RUN cd pg_uuidv7 && make && make install && ls -la
|
||||||
WORKDIR /srv
|
|
||||||
COPY . /srv
|
|
||||||
|
|
||||||
# build extension for P16
|
|
||||||
RUN pg_buildext build-16 16
|
|
||||||
|
|
||||||
# create tarball and checksums
|
|
||||||
RUN cp sql/pg_uuidv7--1.5.sql . && TARGETS=$(find * -name pg_uuidv7.so) \
|
|
||||||
&& tar -czvf pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.5.sql pg_uuidv7.control \
|
|
||||||
&& sha256sum pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.5.sql pg_uuidv7.control > SHA256SUMS
|
|
||||||
|
|
||||||
FROM postgres:16-alpine AS env-deploy
|
|
||||||
|
|
||||||
# copy tarball and checksums
|
|
||||||
COPY --from=env-build /srv/pg_uuidv7.tar.gz /srv/SHA256SUMS /srv/
|
|
||||||
|
|
||||||
# add extension to postgres
|
|
||||||
COPY --from=env-build /srv/${PG_MAJOR}/pg_uuidv7.so /usr/lib/postgresql/${PG_MAJOR}/lib
|
|
||||||
COPY --from=env-build /srv/pg_uuidv7.control /usr/share/postgresql/${PG_MAJOR}/extension
|
|
||||||
COPY --from=env-build /srv/pg_uuidv7--1.5.sql /usr/share/postgresql/${PG_MAJOR}/extension
|
|
||||||
|
|
||||||
# Add a script to run the CREATE EXTENSION command
|
# Add a script to run the CREATE EXTENSION command
|
||||||
RUN printf '#!/bin/sh\npsql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_uuidv7;"' > /docker-entrypoint-initdb.d/init.sh
|
RUN printf '#!/bin/sh\npsql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_uuidv7;"' > /docker-entrypoint-initdb.d/init.sh
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue