2019-09-16 07:48:11 -05:00
|
|
|
########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2023-02-08 08:28:57 -06:00
|
|
|
# Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
2019-09-16 07:48:11 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
# Create a Node container which will be used to build the JS components
|
|
|
|
# and clean up the web/ source code
|
|
|
|
#########################################################################
|
|
|
|
|
2022-12-07 05:03:51 -06:00
|
|
|
FROM alpine:latest AS app-builder
|
2019-09-16 07:48:11 -05:00
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
bash \
|
|
|
|
g++ \
|
2021-02-09 07:12:19 -06:00
|
|
|
git \
|
2019-09-16 07:48:11 -05:00
|
|
|
libc6-compat \
|
|
|
|
libjpeg-turbo-dev \
|
|
|
|
libpng-dev \
|
2021-02-10 04:21:06 -06:00
|
|
|
libtool \
|
2019-09-16 07:48:11 -05:00
|
|
|
make \
|
|
|
|
nasm \
|
2021-02-09 07:12:19 -06:00
|
|
|
nodejs \
|
|
|
|
yarn \
|
2019-09-16 07:48:11 -05:00
|
|
|
zlib-dev
|
|
|
|
|
|
|
|
# Create the /pgadmin4 directory and copy the source into it. Explicitly
|
|
|
|
# remove the node_modules directory as we'll recreate a clean version, as well
|
|
|
|
# as various other files we don't want
|
|
|
|
COPY web /pgadmin4/web
|
|
|
|
RUN rm -rf /pgadmin4/web/*.log \
|
|
|
|
/pgadmin4/web/config_*.py \
|
|
|
|
/pgadmin4/web/node_modules \
|
|
|
|
/pgadmin4/web/regression \
|
|
|
|
`find /pgadmin4/web -type d -name tests` \
|
|
|
|
`find /pgadmin4/web -type f -name .DS_Store`
|
|
|
|
|
|
|
|
WORKDIR /pgadmin4/web
|
|
|
|
|
|
|
|
# Build the JS vendor code in the app-builder, and then remove the vendor source.
|
2021-02-23 10:12:55 -06:00
|
|
|
RUN export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" && \
|
|
|
|
yarn install && \
|
2019-09-16 07:48:11 -05:00
|
|
|
yarn run bundle && \
|
|
|
|
rm -rf node_modules \
|
|
|
|
yarn.lock \
|
|
|
|
package.json \
|
|
|
|
.[^.]* \
|
|
|
|
babel.cfg \
|
|
|
|
webpack.* \
|
|
|
|
karma.conf.js \
|
|
|
|
./pgadmin/static/js/generated/.cache
|
|
|
|
|
|
|
|
#########################################################################
|
2021-02-09 07:12:19 -06:00
|
|
|
# Next, create the base environment for Python
|
2019-09-16 07:48:11 -05:00
|
|
|
#########################################################################
|
|
|
|
|
2022-12-07 05:03:51 -06:00
|
|
|
FROM alpine:latest as env-builder
|
2019-09-16 07:48:11 -05:00
|
|
|
|
2021-02-01 04:52:41 -06:00
|
|
|
# Install dependencies
|
|
|
|
COPY requirements.txt /
|
2021-02-09 07:12:19 -06:00
|
|
|
RUN apk add --no-cache \
|
2019-09-16 07:48:11 -05:00
|
|
|
make \
|
2021-02-09 07:12:19 -06:00
|
|
|
python3 \
|
|
|
|
py3-pip && \
|
|
|
|
apk add --no-cache --virtual build-deps \
|
2019-09-16 07:48:11 -05:00
|
|
|
build-base \
|
|
|
|
openssl-dev \
|
2021-02-01 04:52:41 -06:00
|
|
|
libffi-dev \
|
|
|
|
postgresql-dev \
|
2021-02-08 05:00:41 -06:00
|
|
|
krb5-dev \
|
|
|
|
rust \
|
2021-02-09 07:12:19 -06:00
|
|
|
cargo \
|
2021-12-02 05:17:18 -06:00
|
|
|
zlib-dev \
|
|
|
|
libjpeg-turbo-dev \
|
|
|
|
libpng-dev \
|
2021-02-09 07:12:19 -06:00
|
|
|
python3-dev && \
|
|
|
|
python3 -m venv --system-site-packages --without-pip /venv && \
|
|
|
|
/venv/bin/python3 -m pip install --no-cache-dir -r requirements.txt && \
|
|
|
|
apk del --no-cache build-deps
|
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
# Now, create a documentation build container for the Sphinx docs
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
FROM env-builder as docs-builder
|
|
|
|
|
|
|
|
# Install Sphinx
|
2023-01-17 06:00:22 -06:00
|
|
|
RUN /venv/bin/python3 -m pip install --no-cache-dir sphinx
|
2022-12-19 00:29:21 -06:00
|
|
|
RUN /venv/bin/python3 -m pip install --no-cache-dir sphinxcontrib-youtube
|
2019-09-16 07:48:11 -05:00
|
|
|
|
|
|
|
# Copy the docs from the local tree. Explicitly remove any existing builds that
|
|
|
|
# may be present
|
|
|
|
COPY docs /pgadmin4/docs
|
|
|
|
COPY web /pgadmin4/web
|
|
|
|
RUN rm -rf /pgadmin4/docs/en_US/_build
|
|
|
|
|
|
|
|
# Build the docs
|
2021-02-09 07:12:19 -06:00
|
|
|
RUN LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 /venv/bin/sphinx-build /pgadmin4/docs/en_US /pgadmin4/docs/en_US/_build/html
|
2019-09-16 07:48:11 -05:00
|
|
|
|
2021-02-01 10:55:03 -06:00
|
|
|
# Cleanup unwanted files
|
2021-02-09 07:12:19 -06:00
|
|
|
RUN rm -rf /pgadmin4/docs/en_US/_build/html/.doctrees
|
2021-02-01 10:55:03 -06:00
|
|
|
RUN rm -rf /pgadmin4/docs/en_US/_build/html/_sources
|
|
|
|
RUN rm -rf /pgadmin4/docs/en_US/_build/html/_static/*.png
|
|
|
|
|
2019-09-16 07:48:11 -05:00
|
|
|
#########################################################################
|
|
|
|
# Create additional builders to get all of the PostgreSQL utilities
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
FROM postgres:10-alpine as pg10-builder
|
|
|
|
FROM postgres:11-alpine as pg11-builder
|
2019-10-11 05:13:06 -05:00
|
|
|
FROM postgres:12-alpine as pg12-builder
|
2021-01-20 07:17:21 -06:00
|
|
|
FROM postgres:13-alpine as pg13-builder
|
2021-10-04 05:42:45 -05:00
|
|
|
FROM postgres:14-alpine as pg14-builder
|
2022-10-17 04:02:45 -05:00
|
|
|
FROM postgres:15-alpine as pg15-builder
|
2019-09-16 07:48:11 -05:00
|
|
|
|
2022-12-07 05:03:51 -06:00
|
|
|
FROM alpine:latest as tool-builder
|
2019-09-16 07:48:11 -05:00
|
|
|
|
|
|
|
# Copy the PG binaries
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-10/
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-10/
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-10/
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-10/
|
|
|
|
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-11/
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-11/
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-11/
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-11/
|
|
|
|
|
2019-10-11 05:13:06 -05:00
|
|
|
COPY --from=pg12-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-12/
|
|
|
|
COPY --from=pg12-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-12/
|
|
|
|
COPY --from=pg12-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-12/
|
|
|
|
COPY --from=pg12-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-12/
|
|
|
|
|
2021-01-20 07:17:21 -06:00
|
|
|
COPY --from=pg13-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-13/
|
|
|
|
COPY --from=pg13-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-13/
|
|
|
|
COPY --from=pg13-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-13/
|
|
|
|
COPY --from=pg13-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-13/
|
|
|
|
|
2021-10-04 05:42:45 -05:00
|
|
|
COPY --from=pg14-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-14/
|
|
|
|
COPY --from=pg14-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-14/
|
|
|
|
COPY --from=pg14-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-14/
|
|
|
|
COPY --from=pg14-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-14/
|
2021-10-05 06:45:55 -05:00
|
|
|
|
2022-10-17 04:02:45 -05:00
|
|
|
COPY --from=pg15-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-15/
|
|
|
|
COPY --from=pg15-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-15/
|
|
|
|
COPY --from=pg15-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-15/
|
|
|
|
COPY --from=pg15-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-15/
|
|
|
|
|
2019-09-16 07:48:11 -05:00
|
|
|
#########################################################################
|
|
|
|
# Assemble everything into the final container.
|
|
|
|
#########################################################################
|
|
|
|
|
2022-12-07 05:03:51 -06:00
|
|
|
FROM alpine:latest
|
2021-02-09 07:12:19 -06:00
|
|
|
|
|
|
|
# Copy in the Python packages
|
|
|
|
COPY --from=env-builder /venv /venv
|
2019-09-16 07:48:11 -05:00
|
|
|
|
2021-02-09 07:12:19 -06:00
|
|
|
# Copy in the tools
|
2019-09-16 07:48:11 -05:00
|
|
|
COPY --from=tool-builder /usr/local/pgsql /usr/local/
|
2022-10-17 04:02:45 -05:00
|
|
|
COPY --from=pg15-builder /usr/local/lib/libpq.so.5.15 /usr/lib/
|
|
|
|
RUN ln -s libpq.so.5.15 /usr/lib/libpq.so.5 && \
|
|
|
|
ln -s libpq.so.5.15 /usr/lib/libpq.so
|
2019-09-16 07:48:11 -05:00
|
|
|
|
|
|
|
WORKDIR /pgadmin4
|
|
|
|
ENV PYTHONPATH=/pgadmin4
|
|
|
|
|
|
|
|
# Copy in the code and docs
|
|
|
|
COPY --from=app-builder /pgadmin4/web /pgadmin4
|
|
|
|
COPY --from=docs-builder /pgadmin4/docs/en_US/_build/html/ /pgadmin4/docs
|
2021-02-09 07:12:19 -06:00
|
|
|
COPY pkg/docker/run_pgadmin.py /pgadmin4
|
|
|
|
COPY pkg/docker/gunicorn_config.py /pgadmin4
|
|
|
|
COPY pkg/docker/entrypoint.sh /entrypoint.sh
|
2019-09-16 07:48:11 -05:00
|
|
|
|
2020-07-17 11:06:16 -05:00
|
|
|
# License files
|
|
|
|
COPY LICENSE /pgadmin4/LICENSE
|
|
|
|
COPY DEPENDENCIES /pgadmin4/DEPENDENCIES
|
|
|
|
|
2021-02-09 07:12:19 -06:00
|
|
|
# Install runtime dependencies and configure everything in one RUN step
|
|
|
|
RUN apk add \
|
|
|
|
python3 \
|
|
|
|
py3-pip \
|
2019-09-16 07:48:11 -05:00
|
|
|
postfix \
|
2021-01-18 05:02:10 -06:00
|
|
|
krb5-libs \
|
2021-12-02 05:17:18 -06:00
|
|
|
libjpeg-turbo \
|
2019-12-08 23:39:46 -06:00
|
|
|
shadow \
|
2020-01-20 04:41:27 -06:00
|
|
|
sudo \
|
2021-02-09 07:12:19 -06:00
|
|
|
libedit \
|
2021-11-30 05:56:41 -06:00
|
|
|
libldap \
|
2019-12-08 23:39:46 -06:00
|
|
|
libcap && \
|
2021-02-09 07:12:19 -06:00
|
|
|
/venv/bin/python3 -m pip install --no-cache-dir gunicorn && \
|
|
|
|
find / -type d -name '__pycache__' -exec rm -rf {} + && \
|
2022-03-21 06:19:33 -05:00
|
|
|
useradd -r -u 5050 -g root -s /sbin/nologin pgadmin && \
|
2019-12-08 23:39:46 -06:00
|
|
|
mkdir -p /var/lib/pgadmin && \
|
2022-03-21 06:19:33 -05:00
|
|
|
chown pgadmin:root /var/lib/pgadmin && \
|
|
|
|
chmod g=u /var/lib/pgadmin && \
|
2019-12-08 23:39:46 -06:00
|
|
|
touch /pgadmin4/config_distro.py && \
|
2022-03-21 06:19:33 -05:00
|
|
|
chown pgadmin:root /pgadmin4/config_distro.py && \
|
|
|
|
chmod g=u /pgadmin4/config_distro.py && \
|
|
|
|
chmod g=u /etc/passwd && \
|
2022-08-04 05:50:56 -05:00
|
|
|
setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/python3.10 && \
|
2022-03-21 06:19:33 -05:00
|
|
|
echo "pgadmin ALL = NOPASSWD: /usr/sbin/postfix start" > /etc/sudoers.d/postfix && \
|
|
|
|
echo "pgadminr ALL = NOPASSWD: /usr/sbin/postfix start" >> /etc/sudoers.d/postfix
|
2021-02-09 07:12:19 -06:00
|
|
|
|
2019-12-08 23:39:46 -06:00
|
|
|
USER pgadmin
|
|
|
|
|
2019-09-16 07:48:11 -05:00
|
|
|
# Finish up
|
|
|
|
VOLUME /var/lib/pgadmin
|
|
|
|
EXPOSE 80 443
|
|
|
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|