Skip to content

Commit

Permalink
Add installation of postgresml-python and fix many issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ALVSoft committed Dec 20, 2024
1 parent 47300ab commit d3f6bd2
Show file tree
Hide file tree
Showing 76 changed files with 469 additions and 1,279 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
free-disk-space:
runs-on: ubuntu-latest
steps:

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
Expand All @@ -21,19 +18,15 @@ jobs:
large-packages: true
docker-images: true
swap-storage: true

build:
if: ${{ always() }}
needs: free-disk-space
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -49,7 +42,6 @@ jobs:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Login to c8n.io Harbor Container Registry
# uses: docker/login-action@v3
# with:
Expand All @@ -72,7 +64,6 @@ jobs:
tags: |
alvsoft/postgres:16
alvsoft/postgres:latest
# c8n.io/lucatchomba/postgres:16
# c8n.io/lucatchomba/postgres:latest
# ghcr.io/alvsoft/postgres:latest
Expand Down
21 changes: 0 additions & 21 deletions Dockerfile.back
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ ARG CGAL_GIT_BRANCH=5.6.x-branch
FROM postgres:${PG_MAJOR_VERSION} AS builder
ARG PG_MAJOR_VERSION
ARG DOCKER_CMAKE_BUILD_TYPE

LABEL maintainer="TKamitaSoft Service - https://tkamitasoft.com" \
org.opencontainers.image.description="TKamitaSoft PostgrSQL database" \
org.opencontainers.image.source="https://gitlab.com/tkamitasoft/apps/host"

WORKDIR /

# apt-get install
RUN set -ex \
&& apt-get update -y \
Expand Down Expand Up @@ -76,9 +73,7 @@ RUN set -ex \
libqhull-dev \
libwebp-dev \
libzstd-dev

ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE}

# cgal & sfcgal
# By utilizing the latest commit of the CGAL 5.x.x-branch and implementing a header-only build for SFCGAL,
# one can benefit from the latest CGAL patches while avoiding compatibility issues.
Expand Down Expand Up @@ -116,7 +111,6 @@ RUN set -ex \
# clean
&& rm -fr /usr/src/SFCGAL \
&& rm -fr /usr/src/cgal

# proj
ENV PROJ_GIT_HASH=356496f7b60ee0235189dd51d99aac700fbd2bdc
RUN set -ex \
Expand Down Expand Up @@ -146,7 +140,6 @@ RUN set -ex \
fi \
\
&& rm -fr /usr/src/PROJ

# geos
ENV GEOS_GIT_HASH=a8d2ed0aba46f88f9b8987526e68eea6565d16ae
RUN set -ex \
Expand All @@ -162,7 +155,6 @@ RUN set -ex \
&& make install \
&& cd / \
&& rm -fr /usr/src/geos

# gdal
ENV GDAL_GIT_HASH=d7aed6e0b03f949ba40684f868c63a08d89177b1
RUN set -ex \
Expand Down Expand Up @@ -232,7 +224,6 @@ RUN set -ex \
&& make install \
&& cd / \
&& rm -fr /usr/src/gdal

# Minimal command line test.
RUN set -ex \
&& ldconfig \
Expand All @@ -244,15 +235,12 @@ RUN set -ex \
&& proj \
&& sfcgal-config --version \
&& pcre-config --version

# -------------------------------------------
# STAGE final
# -------------------------------------------
FROM postgres:${PG_MAJOR_VERSION}

ARG DOCKER_CMAKE_BUILD_TYPE
ENV DOCKER_CMAKE_BUILD_TYPE=${DOCKER_CMAKE_BUILD_TYPE}

RUN set -ex \&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
curl \
Expand Down Expand Up @@ -290,18 +278,15 @@ RUN set -ex \&& apt-get update -y \
libqhull-r8.0 \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /_pgis*.* /
COPY --from=builder /usr/local /usr/local

ARG CGAL_GIT_BRANCH
ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH}
ENV CGAL5X_GIT_HASH=188e51bad36ffc30e49dbabda29620b71a84664c
ENV SFCGAL_GIT_HASH=61f3b08ade49493b56c6bafa98c7c1f84addbc10
ENV PROJ_GIT_HASH=356496f7b60ee0235189dd51d99aac700fbd2bdc
ENV GEOS_GIT_HASH=a8d2ed0aba46f88f9b8987526e68eea6565d16ae
ENV GDAL_GIT_HASH=d7aed6e0b03f949ba40684f868c63a08d89177b1

# Minimal command line test ( fail fast )
RUN set -ex \
&& ldconfig \
Expand All @@ -317,15 +302,13 @@ RUN set -ex \
# Testing ogr2ogr PostgreSQL driver.
&& ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \
|| echo "ogr2ogr missing PostgreSQL driver" && exit 1

# install postgis, pgvector, pgmq, pg_partman, potgresml, pgcat, patroni, pgcopydb
ENV POSTGIS_GIT_HASH=8ed84517a9b86c86724504d1b6a0f0c1ccd86cf6
ENV PGVECTOR_GIT_HASH=v0.7.2
ENV PGMQ_GIT_HASH=v1.3.3
ENV PGPARTMAN_GIT_HASH=v5.1.0
ENV TZ=UTC
ENV DEBIAN_FRONTEND=noninteractive

RUN set -ex \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -y \
Expand Down Expand Up @@ -506,19 +489,15 @@ RUN set -ex \
xsltproc \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /root/.cache

RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./postgis/initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
COPY ./postgis/update-postgis.sh /usr/local/bin

COPY ./patroni/entrypoint.sh /

EXPOSE 5432 8008
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 EDITOR=/usr/bin/editor
USER postgres
WORKDIR /home/postgres
CMD ["/bin/bash", "/entrypoint.sh"]

# last final test
RUN set -ex \
&& ldconfig \
Expand Down
15 changes: 0 additions & 15 deletions Dockerfile.citus
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ ARG PGHOME=/home/postgres
ARG PGDATA=$PGHOME/data
ARG LC_ALL=C.UTF-8
ARG LANG=C.UTF-8

FROM postgres:$PG_MAJOR as builder

ARG PGHOME
ARG PGDATA
ARG LC_ALL
ARG LANG

ENV ETCDVERSION=3.3.13 CONFDVERSION=0.16.0

RUN set -ex \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommend \
Expand Down Expand Up @@ -121,7 +117,6 @@ RUN set -ex \
&& find /var/log -type f -exec truncate --size 0 {} \; \
&& find /usr/lib/python3/dist-packages -name '*test*' | xargs rm -fr \
&& find /lib/$(uname -m)-linux-gnu/security -type f ! -name pam_env.so ! -name pam_permit.so ! -name pam_unix.so -delete

# perform compression if it is necessary
ARG COMPRESS
RUN if [ "$COMPRESS" = "true" ]; then \
Expand All @@ -147,33 +142,25 @@ RUN if [ "$COMPRESS" = "true" ]; then \
else \
/bin/busybox --install -s; \
fi

FROM scratch
COPY --from=builder / /

LABEL maintainer="Alexander Kukushkin <akukushkin@microsoft.com>"

ARG PG_MAJOR
ARG COMPRESS
ARG PGHOME
ARG PGDATA
ARG LC_ALL
ARG LANG

ARG PGBIN=/usr/lib/postgresql/$PG_MAJOR/bin

ENV LC_ALL=$LC_ALL LANG=$LANG EDITOR=/usr/bin/editor
ENV PGDATA=$PGDATA PATH=$PATH:$PGBIN
ENV ETCDCTL_API=3

COPY patroni /patroni/
COPY extras/confd/conf.d/haproxy.toml /etc/confd/conf.d/
COPY extras/confd/templates/haproxy-citus.tmpl /etc/confd/templates/haproxy.tmpl
COPY patroni*.py docker/entrypoint.sh /
COPY postgres?.yml $PGHOME/

WORKDIR $PGHOME

RUN sed -i 's/env python/&3/' /patroni*.py \
# "fix" patroni configs
&& sed -i 's/^ listen: 127.0.0.1/ listen: 0.0.0.0/' postgres?.yml \
Expand All @@ -195,7 +182,5 @@ RUN sed -i 's/env python/&3/' /patroni*.py \
&& if [ "$COMPRESS" = "true" ]; then chmod u+s /usr/bin/sudo; fi \
&& chmod +s /bin/ping \
&& chown -R postgres:postgres $PGHOME /run /etc/haproxy

USER postgres

ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
6 changes: 0 additions & 6 deletions Dockerfile2.back
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
ARG PG_MAJOR_VERSION=16
ARG DEBIAN_FRONTEND=noninteractive
ARG PARADEDB_TELEMETRY=false

FROM postgres:${PG_MAJOR_VERSION}

ARG DEBIAN_FRONTEND
ARG PARADEDB_TELEMETRY
ENV PARADEDB_TELEMETRY=$PARADEDB_TELEMETRY
ENV TZ=UTC

LABEL maintainer="ATCHOMBA Luc Vindjedou - https://www.alvsoft.pro" \
org.opencontainers.image.description="PostgrSQL Server with many extention installed." \
org.opencontainers.image.source="https://github.com/alvsoft/postgres"

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
pgcopydb \
patroni \
check-patroni

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
SHELL [ "/bin/sh", "-s", ".", "$HOME/.cargo/env" ]
RUN cargo install pg-trunk
Expand All @@ -40,6 +35,5 @@ RUN apt-get purge -y curl && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

USER postgres
CMD ["postgres"]
14 changes: 0 additions & 14 deletions Dockerfile3.back
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ ARG PGHOME=/home/postgres
ARG PGDATA=$PGHOME/data
ARG LC_ALL=C.UTF-8
ARG LANG=C.UTF-8

FROM postgres:$PG_MAJOR as builder

ARG PGHOME
ARG PGDATA
ARG LC_ALL
ARG LANG
ARG ETCD_VER=v3.5.15
ARG PATRONI_VER=v3.3.2

RUN set -ex \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommend \
Expand Down Expand Up @@ -95,7 +92,6 @@ RUN set -ex \
&& find /var/log -type f -exec truncate --size 0 {} \; \
&& find /usr/lib/python3/dist-packages -name '*test*' | xargs rm -fr \
&& find /lib/$(uname -m)-linux-gnu/security -type f ! -name pam_env.so ! -name pam_permit.so ! -name pam_unix.so -delete

# perform compression if it is necessary
ARG COMPRESS
RUN if [ "$COMPRESS" = "true" ]; then \
Expand All @@ -121,35 +117,27 @@ RUN if [ "$COMPRESS" = "true" ]; then \
else \
/bin/busybox --install -s; \
fi

FROM scratch
COPY --from=builder / /

LABEL maintainer="ATCHOMBA Luc Vindjedou - <https://www.alvsoft.pro>" \
org.opencontainers.image.description="PostgrSQL Server with many extention installed." \
org.opencontainers.image.source="https://github.com/alvsoft/postgres"

ARG PG_MAJOR
ARG COMPRESS
ARG PGHOME
ARG PGDATA
ARG LC_ALL
ARG LANG

ARG PGBIN=/usr/lib/postgresql/$PG_MAJOR/bin

ENV LC_ALL=$LC_ALL LANG=$LANG EDITOR=/usr/bin/editor
ENV PGDATA=$PGDATA PATH=$PATH:$PGBIN
ENV ETCDCTL_API=3

COPY --from=builder /usr/src/patroni/patroni /patroni/
COPY --from=builder /usr/src/patroni/extras/confd/conf.d/haproxy.toml /etc/confd/conf.d/
COPY --from=builder /usr/src/patroni/extras/confd/templates/haproxy.tmpl /etc/confd/templates/
COPY patroni*.py docker/entrypoint.sh /
COPY postgres?.yml $PGHOME/

WORKDIR $PGHOME

RUN rm -rf /usr/src/patroni \
&& sed -i 's/env python/&3/' /patroni*.py \
# "fix" patroni configs
Expand All @@ -165,7 +153,5 @@ RUN rm -rf /usr/src/patroni \
&& if [ "$COMPRESS" = "true" ]; then chmod u+s /usr/bin/sudo; fi \
&& chmod +s /bin/ping \
&& chown -R postgres:postgres "$PGHOME" /run /etc/haproxy

USER postgres

ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
4 changes: 0 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
MIT License

Copyright (c) 2024 ATCHOMBA Vindjedou

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
Loading

0 comments on commit d3f6bd2

Please sign in to comment.