2019-09-16 07:48:11 -05:00
|
|
|
########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2024-01-01 02:43:48 -06:00
|
|
|
# Copyright (C) 2013 - 2024, 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 \
|
2023-03-27 04:56:04 -05:00
|
|
|
npm \
|
2021-02-09 07:12:19 -06:00
|
|
|
yarn \
|
2019-09-16 07:48:11 -05:00
|
|
|
zlib-dev
|
|
|
|
|
2024-06-27 07:33:10 -05:00
|
|
|
COPY .git .git
|
2019-09-16 07:48:11 -05:00
|
|
|
# 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" && \
|
2024-05-23 07:49:08 -05:00
|
|
|
npm install -g corepack && \
|
|
|
|
corepack enable && \
|
2023-10-26 04:47:41 -05:00
|
|
|
yarn set version berry && \
|
2023-10-26 02:44:01 -05:00
|
|
|
yarn set version 3 && \
|
2021-02-23 10:12:55 -06:00
|
|
|
yarn install && \
|
2019-09-16 07:48:11 -05:00
|
|
|
yarn run bundle && \
|
|
|
|
rm -rf node_modules \
|
|
|
|
yarn.lock \
|
|
|
|
package.json \
|
|
|
|
.[^.]* \
|
|
|
|
babel.cfg \
|
|
|
|
webpack.* \
|
2023-10-23 07:13:17 -05:00
|
|
|
jest.config.js \
|
|
|
|
babel.* \
|
2024-06-27 07:33:10 -05:00
|
|
|
./pgadmin/static/js/generated/.cache \
|
|
|
|
/pgadmin4/.git
|
2019-09-16 07:48:11 -05:00
|
|
|
|
|
|
|
#########################################################################
|
2021-02-09 07:12:19 -06:00
|
|
|
# Next, create the base environment for Python
|
2019-09-16 07:48:11 -05:00
|
|
|
#########################################################################
|
|
|
|
|
2023-06-09 04:58:46 -05: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 /
|
2024-06-12 07:39:06 -05: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
|
|
|
|
#########################################################################
|
|
|
|
|
2023-06-09 04:58:46 -05:00
|
|
|
FROM env-builder AS docs-builder
|
2021-02-09 07:12:19 -06:00
|
|
|
|
|
|
|
# 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
|
|
|
|
#########################################################################
|
|
|
|
|
2023-06-09 04:58:46 -05:00
|
|
|
FROM postgres:12-alpine AS pg12-builder
|
|
|
|
FROM postgres:13-alpine AS pg13-builder
|
|
|
|
FROM postgres:14-alpine AS pg14-builder
|
|
|
|
FROM postgres:15-alpine AS pg15-builder
|
2023-09-21 05:05:44 -05:00
|
|
|
FROM postgres:16-alpine AS pg16-builder
|
2024-10-10 05:25:43 -05:00
|
|
|
FROM postgres:17-alpine AS pg17-builder
|
2019-09-16 07:48:11 -05:00
|
|
|
|
2023-06-09 04:58:46 -05:00
|
|
|
FROM alpine:latest AS tool-builder
|
2019-09-16 07:48:11 -05:00
|
|
|
|
|
|
|
# Copy the PG binaries
|
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/
|
|
|
|
|
2023-09-21 05:05:44 -05:00
|
|
|
COPY --from=pg16-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-16/
|
|
|
|
COPY --from=pg16-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-16/
|
|
|
|
COPY --from=pg16-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-16/
|
|
|
|
COPY --from=pg16-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-16/
|
|
|
|
|
2024-10-10 05:25:43 -05:00
|
|
|
COPY --from=pg17-builder /usr/local/bin/pg_dump /usr/local/pgsql/pgsql-17/
|
|
|
|
COPY --from=pg17-builder /usr/local/bin/pg_dumpall /usr/local/pgsql/pgsql-17/
|
|
|
|
COPY --from=pg17-builder /usr/local/bin/pg_restore /usr/local/pgsql/pgsql-17/
|
|
|
|
COPY --from=pg17-builder /usr/local/bin/psql /usr/local/pgsql/pgsql-17/
|
|
|
|
|
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/
|
2024-10-10 05:25:43 -05:00
|
|
|
COPY --from=pg17-builder /usr/local/lib/libpq.so.5.17 /usr/lib/
|
|
|
|
COPY --from=pg17-builder /usr/lib/libzstd.so.1.5.6 /usr/lib/
|
2024-12-16 03:28:47 -06:00
|
|
|
COPY --from=pg17-builder /usr/lib/liblz4.so.1.10.0 /usr/lib/
|
2023-09-27 06:39:49 -05:00
|
|
|
|
2024-10-10 05:25:43 -05:00
|
|
|
RUN ln -s libpq.so.5.17 /usr/lib/libpq.so.5 && \
|
|
|
|
ln -s libpq.so.5.17 /usr/lib/libpq.so && \
|
2024-05-23 07:49:08 -05:00
|
|
|
ln -s libzstd.so.1.5.6 /usr/lib/libzstd.so.1 && \
|
2024-12-16 03:28:47 -06:00
|
|
|
ln -s liblz4.so.1.10.0 /usr/lib/liblz4.so.1
|
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
|
2024-06-12 07:39:06 -05:00
|
|
|
RUN apk add --no-cache \
|
2021-02-09 07:12:19 -06:00
|
|
|
python3 \
|
2024-10-07 01:14:20 -05:00
|
|
|
bash \
|
2021-02-09 07:12:19 -06:00
|
|
|
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 \
|
2023-11-29 00:00:52 -06:00
|
|
|
tzdata \
|
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 && \
|
2024-05-31 03:59:36 -05:00
|
|
|
/venv/bin/python3 -m pip install --no-cache-dir gunicorn==22.0.0 && \
|
2021-02-09 07:12:19 -06:00
|
|
|
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 && \
|
2024-03-26 07:52:29 -05:00
|
|
|
mkdir -p /run/pgadmin /var/lib/pgadmin && \
|
|
|
|
chown pgadmin:root /run/pgadmin /var/lib/pgadmin && \
|
2022-03-21 06:19:33 -05:00
|
|
|
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 && \
|
2024-05-24 01:52:32 -05:00
|
|
|
setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/python3.12 && \
|
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"]
|