buildx/pgadmin4/Dockerfile
2020-07-29 16:01:00 +02:00

63 lines
3.0 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
COPY --from=tool-builder /usr/local/pgsql /usr/local/
ARG TARGETARCH
ARG VERSION=4.24
ARG GUNICORN_VERSION=20.0.4
RUN apt update -qq && apt install -qqy --no-install-recommends python3-pip python3-dev python3-setuptools gcc && \
pip3 install --no-cache-dir pgadmin4==${VERSION} gunicorn==${GUNICORN_VERSION} && \
apt remove -qqy gcc python3-dev python3-pip && apt autoremove -qqy && rm -rf /var/lib/apt/lists/* && \
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
COPY entrypoint.sh /entrypoint.sh
COPY run_pgadmin.py /pgadmin4/
WORKDIR /pgadmin4
USER 5050
VOLUME /var/lib/pgadmin
ENTRYPOINT ["/entrypoint.sh"]