First commit
This commit is contained in:
commit
c4b315c967
5 changed files with 488 additions and 0 deletions
46
Dockerfile
Normal file
46
Dockerfile
Normal file
|
@ -0,0 +1,46 @@
|
|||
FROM buildpack-deps:bullseye
|
||||
|
||||
ARG SRV_UID="1000"
|
||||
ARG SRV_GID="100"
|
||||
ARG SRV_VERSION="0"
|
||||
|
||||
ENV SRV_UID $SRV_UID
|
||||
ENV SRV_GID $SRV_GID
|
||||
ENV SRV_VERSION $SRV_VERSION
|
||||
|
||||
ENV DEBIAN_FRONTEND "noninteractive"
|
||||
ENV PGDATA "/pgdata"
|
||||
|
||||
# explicitly set user/group IDs
|
||||
RUN if [ -z "$( getent group $SRV_GID )" ] ; then groupadd -r postgres --gid=$SRV_GID ; fi && \
|
||||
useradd -r -g $SRV_GID --uid=$SRV_UID --home-dir=/var/lib/postgresql --shell=/bin/bash postgres && \
|
||||
mkdir -p /pgdata && chown -R $SRV_UID:$SRV_GID /pgdata && \
|
||||
apt-get update -y && apt-get install -y lsb-release && \
|
||||
( curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg ) && \
|
||||
( echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list ) && \
|
||||
apt-get update -y && mkdir -p /docker-entrypoint-initdb.d && \
|
||||
apt-get install -y postgresql-14 postgresql-14-pglogical && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV PATH="/usr/lib/postgresql/14/bin:$PATH"
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
USER $SRV_UID:$SRV_GID
|
||||
|
||||
RUN ln -s /pgdata/.bash_history $HOME/.bash_history
|
||||
|
||||
VOLUME /pgdata
|
||||
|
||||
WORKDIR /pgdata
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
STOPSIGNAL SIGINT
|
||||
|
||||
EXPOSE 5432
|
||||
|
||||
CMD ["postgres"]
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --retries=4 \
|
||||
CMD pg_isready -U ${POSTGRES_USER:-postgres}
|
Loading…
Add table
Add a link
Reference in a new issue