2017-09-21 10:49:37 -05:00
|
|
|
########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2018-01-05 04:42:49 -06:00
|
|
|
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
2017-09-21 10:49:37 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
#########################################################################
|
|
|
|
|
2018-04-04 10:18:17 -05:00
|
|
|
# First of all, build frontend with NodeJS in a separate builder container
|
2018-09-14 11:04:51 -05:00
|
|
|
# Node-8 is supported by all needed C++ packages
|
|
|
|
FROM node:8 AS node-builder
|
2017-09-21 10:49:37 -05:00
|
|
|
|
2018-04-04 10:18:17 -05:00
|
|
|
COPY ./pgadmin4/web/ /pgadmin4/web/
|
|
|
|
WORKDIR /pgadmin4/web
|
2017-09-21 10:49:37 -05:00
|
|
|
|
2018-05-30 15:53:03 -05:00
|
|
|
RUN yarn install --cache-folder ./ycache --verbose && \
|
|
|
|
yarn run bundle && \
|
2018-04-04 10:18:17 -05:00
|
|
|
rm -rf ./ycache ./pgadmin/static/js/generated/.cache
|
2017-09-21 10:49:37 -05:00
|
|
|
|
2018-04-04 10:18:17 -05:00
|
|
|
# Build Sphinx documentation in separate container
|
2019-02-13 11:18:14 -06:00
|
|
|
FROM python:3.7-alpine3.9 as docs-builder
|
2017-09-21 10:49:37 -05:00
|
|
|
|
2018-04-04 10:18:17 -05:00
|
|
|
# Install only dependencies absolutely required for documentation building
|
2019-05-28 17:09:06 -05:00
|
|
|
RUN apk add --no-cache make build-base libffi-dev && \
|
2019-05-28 17:01:56 -05:00
|
|
|
pip install --no-cache-dir sphinx flask_security flask_paranoid python-dateutil flask_sqlalchemy flask_gravatar flask_migrate simplejson cryptography
|
2017-09-21 10:49:37 -05:00
|
|
|
|
2018-04-04 10:18:17 -05:00
|
|
|
COPY ./pgadmin4/ /pgadmin4
|
2017-10-12 04:12:55 -05:00
|
|
|
|
2019-03-01 06:29:05 -06:00
|
|
|
# Build the docs
|
2018-04-04 10:18:17 -05:00
|
|
|
RUN LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 make -C /pgadmin4/docs/en_US -f Makefile.sphinx html
|
2017-10-12 04:12:55 -05:00
|
|
|
|
2019-02-20 09:17:16 -06:00
|
|
|
# Get the PG binaries
|
|
|
|
FROM postgres:9.4-alpine as pg94-builder
|
|
|
|
FROM postgres:9.5-alpine as pg95-builder
|
|
|
|
FROM postgres:9.6-alpine as pg96-builder
|
|
|
|
FROM postgres:10-alpine as pg10-builder
|
|
|
|
FROM postgres:11-alpine as pg11-builder
|
|
|
|
|
2018-04-04 10:18:17 -05:00
|
|
|
# Then install backend, copy static files and set up entrypoint
|
2019-02-13 11:18:14 -06:00
|
|
|
FROM python:3.7-alpine3.9
|
2017-09-21 10:49:37 -05:00
|
|
|
|
2019-02-20 09:17:16 -06:00
|
|
|
# Copy the PG binaries
|
|
|
|
COPY --from=pg94-builder /usr/local/bin/pg_dump /usr/local/pgsql-9.4/
|
|
|
|
COPY --from=pg94-builder /usr/local/bin/pg_dumpall /usr/local/pgsql-9.4/
|
|
|
|
COPY --from=pg94-builder /usr/local/bin/pg_restore /usr/local/pgsql-9.4/
|
|
|
|
COPY --from=pg94-builder /usr/local/bin/psql /usr/local/pgsql-9.4/
|
|
|
|
|
|
|
|
COPY --from=pg95-builder /usr/local/bin/pg_dump /usr/local/pgsql-9.5/
|
|
|
|
COPY --from=pg95-builder /usr/local/bin/pg_dumpall /usr/local/pgsql-9.5/
|
|
|
|
COPY --from=pg95-builder /usr/local/bin/pg_restore /usr/local/pgsql-9.5/
|
|
|
|
COPY --from=pg95-builder /usr/local/bin/psql /usr/local/pgsql-9.5/
|
|
|
|
|
|
|
|
COPY --from=pg96-builder /usr/local/bin/pg_dump /usr/local/pgsql-9.6/
|
|
|
|
COPY --from=pg96-builder /usr/local/bin/pg_dumpall /usr/local/pgsql-9.6/
|
|
|
|
COPY --from=pg96-builder /usr/local/bin/pg_restore /usr/local/pgsql-9.6/
|
|
|
|
COPY --from=pg96-builder /usr/local/bin/psql /usr/local/pgsql-9.6/
|
|
|
|
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/pg_dump /usr/local/pgsql-10/
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/pg_dumpall /usr/local/pgsql-10/
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/pg_restore /usr/local/pgsql-10/
|
|
|
|
COPY --from=pg10-builder /usr/local/bin/psql /usr/local/pgsql-10/
|
|
|
|
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/pg_dump /usr/local/pgsql-11/
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/pg_dumpall /usr/local/pgsql-11/
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/pg_restore /usr/local/pgsql-11/
|
|
|
|
COPY --from=pg11-builder /usr/local/bin/psql /usr/local/pgsql-11/
|
|
|
|
|
2019-03-01 06:29:05 -06:00
|
|
|
WORKDIR /pgadmin4
|
|
|
|
ENV PYTHONPATH=/pgadmin4
|
|
|
|
|
|
|
|
#Copy in the docs and JS/CSS bundles
|
|
|
|
COPY --from=node-builder /pgadmin4/web/pgadmin/static/js/generated/ /pgadmin4/pgadmin/static/js/generated/
|
|
|
|
COPY --from=docs-builder /pgadmin4/docs/en_US/_build/html/ /pgadmin4/docs/
|
|
|
|
|
|
|
|
# Install build-dependencies, build & install C extensions and purge deps in one RUN step
|
|
|
|
# so that deps do not increase the size of resulting image by remaining in layers
|
|
|
|
COPY ./pgadmin4/requirements.txt /pgadmin4
|
|
|
|
RUN apk add --no-cache --virtual build-deps build-base postgresql-dev libffi-dev linux-headers && \
|
|
|
|
apk add postfix postgresql-client postgresql-libs && \
|
|
|
|
pip install --upgrade pip && \
|
|
|
|
pip install --no-cache-dir -r requirements.txt && \
|
|
|
|
pip install --no-cache-dir gunicorn && \
|
|
|
|
apk del --no-cache build-deps
|
|
|
|
|
|
|
|
# Copy the code
|
|
|
|
COPY ./pgadmin4/web /pgadmin4
|
|
|
|
COPY ./run_pgadmin.py /pgadmin4
|
|
|
|
COPY ./config_distro.py /pgadmin4
|
|
|
|
COPY ./entrypoint.sh /entrypoint.sh
|
|
|
|
|
|
|
|
# Precompile and optimize python code to save time and space on startup
|
|
|
|
RUN python -O -m compileall /pgadmin4
|
|
|
|
|
2019-02-20 09:17:16 -06:00
|
|
|
# Finish up
|
2018-04-04 10:18:17 -05:00
|
|
|
VOLUME /var/lib/pgadmin
|
2017-09-21 10:49:37 -05:00
|
|
|
EXPOSE 80 443
|
|
|
|
|
2018-04-04 10:18:17 -05:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|