buildx/pgadmin4/Dockerfile

70 lines
3.5 KiB
Docker

FROM postgres:9.5 as pg95-builder
FROM postgres:9.6 as pg96-builder
FROM postgres:10 as pg10-builder
FROM postgres:11 as pg11-builder
FROM postgres:12 as pg12-builder
FROM debian:stable-20200720-slim as tool-builder
# Copy the PG binaries
COPY --from=pg95-builder /usr/lib/postgresql/9.5/bin/pg_dump /usr/local/pgsql/pgsql-9.5/
COPY --from=pg95-builder /usr/lib/postgresql/9.5/bin/pg_dumpall /usr/local/pgsql/pgsql-9.5/
COPY --from=pg95-builder /usr/lib/postgresql/9.5/bin/pg_restore /usr/local/pgsql/pgsql-9.5/
COPY --from=pg95-builder /usr/lib/postgresql/9.5/bin/psql /usr/local/pgsql/pgsql-9.5/
COPY --from=pg96-builder /usr/lib/postgresql/9.6/bin/pg_dump /usr/local/pgsql/pgsql-9.6/
COPY --from=pg96-builder /usr/lib/postgresql/9.6/bin/pg_dumpall /usr/local/pgsql/pgsql-9.6/
COPY --from=pg96-builder /usr/lib/postgresql/9.6/bin/pg_restore /usr/local/pgsql/pgsql-9.6/
COPY --from=pg96-builder /usr/lib/postgresql/9.6/bin/psql /usr/local/pgsql/pgsql-9.6/
COPY --from=pg10-builder /usr/lib/postgresql/10/bin/pg_dump /usr/local/pgsql/pgsql-10/
COPY --from=pg10-builder /usr/lib/postgresql/10/bin/pg_dumpall /usr/local/pgsql/pgsql-10/
COPY --from=pg10-builder /usr/lib/postgresql/10/bin/pg_restore /usr/local/pgsql/pgsql-10/
COPY --from=pg10-builder /usr/lib/postgresql/10/bin/psql /usr/local/pgsql/pgsql-10/
COPY --from=pg11-builder /usr/lib/postgresql/11/bin/pg_dump /usr/local/pgsql/pgsql-11/
COPY --from=pg11-builder /usr/lib/postgresql/11/bin/pg_dumpall /usr/local/pgsql/pgsql-11/
COPY --from=pg11-builder /usr/lib/postgresql/11/bin/pg_restore /usr/local/pgsql/pgsql-11/
COPY --from=pg11-builder /usr/lib/postgresql/11/bin/psql /usr/local/pgsql/pgsql-11/
COPY --from=pg12-builder /usr/lib/postgresql/12/bin/pg_dump /usr/local/pgsql/pgsql-12/
COPY --from=pg12-builder /usr/lib/postgresql/12/bin/pg_dumpall /usr/local/pgsql/pgsql-12/
COPY --from=pg12-builder /usr/lib/postgresql/12/bin/pg_restore /usr/local/pgsql/pgsql-12/
COPY --from=pg12-builder /usr/lib/postgresql/12/bin/psql /usr/local/pgsql/pgsql-12/
FROM debian:stable-20200720-slim
ARG DEBIAN_FRONTEND=noninteractive
ADD https://curl.haxx.se/ca/cacert.pem /etc/ssl/certs/cacert.pem
ENV CURL_CA_BUNDLE=/etc/ssl/certs/cacert.pem
COPY --from=tool-builder /usr/local/pgsql /usr/local/
ARG TARGETARCH
ARG VERSION=4.24
ARG GUNICORN_VERSION=20.0.4
RUN export GH_VERSION=$(echo ${VERSION} | tr '.' '_') && \
apt update -qq && \
apt install -qqy --no-install-recommends curl python3-pip python3-dev python3-setuptools libpq-dev build-essential libffi-dev && \
pip3 install --no-cache-dir pgadmin4==${VERSION} gunicorn==${GUNICORN_VERSION} && \
ln -s /usr/local/lib/python3.7/dist-packages/pgadmin4 /pgadmin4 && \
ln -s /usr/bin/python3 /usr/bin/python && \
groupadd -g 5050 pgadmin && \
useradd -r -u 5050 -g pgadmin pgadmin && \
mkdir -p /var/lib/pgadmin && \
chown pgadmin:pgadmin /var/lib/pgadmin && \
mkdir -p /var/log/pgadmin && \
chown pgadmin:pgadmin /var/log/pgadmin && \
touch /pgadmin4/config_distro.py && \
chown pgadmin:pgadmin /pgadmin4/config_distro.py && \
curl -o /pgadmin4/run_pgadmin.py https://raw.githubusercontent.com/postgres/pgadmin4/REL-${GH_VERSION}/pkg/docker/run_pgadmin.py && \
curl -o /entrypoint.sh https://raw.githubusercontent.com/postgres/pgadmin4/REL-${GH_VERSION}/pkg/docker/entrypoint.sh && \
chmod +x /entrypoint.sh && \
apt remove -qqy python3-dev python3-pip libpq-dev build-essential libffi-dev curl && \
apt autoremove -qqy && rm -rf /var/lib/apt/lists/*
WORKDIR /pgadmin4
USER 5050
VOLUME /var/lib/pgadmin
ENTRYPOINT ["/entrypoint.sh"]