Created
October 22, 2023 09:58
-
-
Save ItsWendell/af2e2b4c93bb2f5d73f34b87406af435 to your computer and use it in GitHub Desktop.
Revisions
-
ItsWendell created this gist
Oct 22, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ ## Alternatives: postgres:15-alpine ARG BASE_IMAGE=postgis/postgis:15-3.4-alpine ## Custom Alpine Postgres docker file with custom extensions FROM ${BASE_IMAGE} as builder # Install required dependencies RUN apk --no-cache add \ python3 \ py3-pip \ cmake \ make \ gcc \ g++ \ clang15 \ llvm15 \ postgresql-dev \ && pip install pgxnclient # Install extensions using pgxn RUN pgxn install 'h3=4.1.3' \ && pgxn install 'vector=0.4.4' \ && pgxn install 'pg_uuidv7=1.3.0' ## Cleanup to reduce image size RUN apk del \ python3 \ py3-pip \ cmake \ make \ gcc \ g++ \ clang15 \ llvm15 \ postgresql-dev \ && rm -rf /var/cache/apk/* \ && rm -rf /root/.cache \ && rm -rf /root/.pgxn ## Custom Alpine Postgres docker file with our extensions FROM ${BASE_IMAGE} ## Copy all extensions from the builder stage COPY --from=builder /usr/local/lib/postgresql/* /usr/local/lib/postgresql/ COPY --from=builder /usr/local/share/postgresql/extension/* /usr/local/share/postgresql/extension/