mirror of
https://github.com/versia-pub/postgres.git
synced 2025-12-06 06:58:20 +01:00
fix: 🐛 Overhaul Dockerfile
This commit is contained in:
parent
9608950c60
commit
07c3d13c81
42
Dockerfile
42
Dockerfile
|
|
@ -1,27 +1,39 @@
|
|||
FROM postgres:17-alpine AS env-build
|
||||
|
||||
RUN apk add --no-cache build-base postgresql-dev git
|
||||
# Install build dependencies in Alpine
|
||||
RUN apk add --no-cache \
|
||||
build-base \
|
||||
postgresql-dev \
|
||||
libpq \
|
||||
linux-headers \
|
||||
git
|
||||
|
||||
# Set working directory and copy files
|
||||
WORKDIR /srv
|
||||
# Copy contents of https://github.com/fboulnois/pg_uuidv7.git into srv
|
||||
RUN git clone https://github.com/fboulnois/pg_uuidv7.git .
|
||||
COPY pg_buildext .
|
||||
RUN git clone https://github.com/fboulnois/pg_uuidv7.git /srv
|
||||
|
||||
# build extension for all supported versions
|
||||
RUN /bin/sh pg_buildext build-17 17
|
||||
# Create directories for each PostgreSQL version to avoid copy errors
|
||||
RUN for v in `seq 13 17`; do \
|
||||
mkdir -p /usr/lib/postgresql/$v/lib; \
|
||||
done
|
||||
|
||||
# create tarball and checksums
|
||||
RUN cp sql/pg_uuidv7--1.6.sql . && TARGETS=$(find * -name pg_uuidv7.so) \
|
||||
&& tar -czvf pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.6.sql pg_uuidv7.control \
|
||||
&& sha256sum pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.6.sql pg_uuidv7.control > SHA256SUMS
|
||||
# Build extension for all supported versions
|
||||
RUN for v in `seq 13 17`; do \
|
||||
echo "Building for PostgreSQL version $v"; \
|
||||
make USE_PGXS=1; \
|
||||
cp pg_uuidv7.so /usr/lib/postgresql/$v/lib/; \
|
||||
done
|
||||
|
||||
# Create tarball and checksums
|
||||
RUN cp sql/pg_uuidv7--1.6.sql . && \
|
||||
TARGETS=$(find * -name pg_uuidv7.so) && \
|
||||
tar -czvf pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.6.sql pg_uuidv7.control && \
|
||||
sha256sum pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.6.sql pg_uuidv7.control > SHA256SUMS
|
||||
|
||||
FROM postgres:17-alpine 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/local/lib/postgresql/pg_uuidv7
|
||||
# Add extension to postgres
|
||||
COPY --from=0 /srv/pg_uuidv7.so /usr/local/lib/postgresql/pg_uuidv7
|
||||
COPY --from=0 /srv/pg_uuidv7.control /usr/local/share/postgresql/extension
|
||||
COPY --from=0 /srv/pg_uuidv7--1.6.sql /usr/local/share/postgresql/extension
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue