-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: split into build and deploy stages
- Loading branch information
Showing
1 changed file
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
FROM postgres:16 | ||
FROM postgres:16 AS env-build | ||
|
||
# install build dependencies | ||
RUN apt-get update && apt-get -y upgrade \ | ||
&& apt-get install -y build-essential libpq-dev postgresql-server-dev-all | ||
|
||
WORKDIR /srv | ||
COPY . /srv | ||
|
||
# build extension for all supported versions | ||
RUN for v in `seq 13 16`; do pg_buildext build-$v $v; done | ||
|
||
# create tarball and checksums | ||
RUN cp sql/pg_uuidv7--1.4.sql . && TARGETS=$(find * -name pg_uuidv7.so) \ | ||
&& tar -czvf pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.4.sql pg_uuidv7.control \ | ||
&& sha256sum pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.4.sql pg_uuidv7.control > SHA256SUMS | ||
|
||
RUN cp ${PG_MAJOR}/pg_uuidv7.so /usr/lib/postgresql/${PG_MAJOR}/lib \ | ||
&& cp pg_uuidv7.control /usr/share/postgresql/${PG_MAJOR}/extension \ | ||
&& cp pg_uuidv7--1.4.sql /usr/share/postgresql/${PG_MAJOR}/extension | ||
FROM postgres:16 AS env-deploy | ||
|
||
# copy tarball and checksums | ||
COPY --from=0 /srv/pg_uuidv7.tar.gz /srv/SHA256SUMS /srv | ||
|
||
# add extension to postgres | ||
COPY --from=0 /srv/${PG_MAJOR}/pg_uuidv7.so /usr/lib/postgresql/${PG_MAJOR}/lib | ||
COPY --from=0 /srv/pg_uuidv7.control /usr/share/postgresql/${PG_MAJOR}/extension | ||
COPY --from=0 /srv/pg_uuidv7--1.4.sql /usr/share/postgresql/${PG_MAJOR}/extension |