more postgres, smaller images

pull/7102/head
Nils Dijk 2021-09-14 16:33:31 +02:00
parent 5c33bf7d95
commit 5d0da20fa8
2 changed files with 33 additions and 7 deletions

View File

@ -1,4 +1,4 @@
FROM ubuntu:21.10 FROM ubuntu:21.10 AS base
# environment is to make python pass an interactive shell, probably not the best timezone given a wide variety of colleagues # environment is to make python pass an interactive shell, probably not the best timezone given a wide variety of colleagues
ENV TZ=Europe/Amsterdam ENV TZ=Europe/Amsterdam
@ -53,18 +53,41 @@ ENV PATH="/home/citus/.pgenv/bin:${PATH}"
ENV PATH="/home/citus/.pgenv/pgsql/bin:${PATH}" ENV PATH="/home/citus/.pgenv/pgsql/bin:${PATH}"
COPY --chown=citus:citus configure.flags .pgenv/ COPY --chown=citus:citus configure.flags .pgenv/
COPY --chown=citus:citus *.tar.bz2 .pgenv/src/ # COPY --chown=citus:citus *.tar.bz2 .pgenv/src/
USER citus USER citus
# TODO add more postgres versions # build postgres versions separately for effective parrallelism and caching of already built versions when changing only certain versions
RUN pgenv build 13.4 FROM base AS pg12
RUN pgenv build 12.8 RUN pgenv build 12.8
RUN rm .pgenv/src/*.tar*
# TODO remove excessive artifacts for smaller images
RUN make -C .pgenv/src/postgresql-*/ clean
FROM base AS pg13
RUN pgenv build 13.4
RUN rm .pgenv/src/*.tar*
# TODO remove excessive artifacts for smaller images
RUN make -C .pgenv/src/postgresql-*/ clean
FROM base AS pg14
RUN pgenv build 14beta3 RUN pgenv build 14beta3
RUN rm .pgenv/src/*.tar*
# TODO remove excessive artifacts for smaller images
RUN make -C .pgenv/src/postgresql-*/ clean
# sets default pg version # assemble the final container by copying over the artifacts from separately build containers
RUN pgenv switch 13.4 FROM base AS devcontainer
COPY --from=pg12 /home/citus/.pgenv/src /home/citus/.pgenv/src
COPY --from=pg12 /home/citus/.pgenv/pgsql-12.8 /home/citus/.pgenv/pgsql-12.8
COPY --from=pg13 /home/citus/.pgenv/src /home/citus/.pgenv/src
COPY --from=pg13 /home/citus/.pgenv/pgsql-13.4 /home/citus/.pgenv/pgsql-13.4
COPY --from=pg14 /home/citus/.pgenv/src /home/citus/.pgenv/src
COPY --from=pg14 /home/citus/.pgenv/pgsql-14beta3 /home/citus/.pgenv/pgsql-14beta3
# add some common tools to the final container
# bin directory for user tools # bin directory for user tools
RUN mkdir .bin RUN mkdir .bin
ENV PATH="/home/citus/.bin:${PATH}" ENV PATH="/home/citus/.bin:${PATH}"
@ -85,3 +108,6 @@ RUN sudo mkdir /data
RUN sudo chown citus:citus /data RUN sudo chown citus:citus /data
COPY --chown=citus:citus .psqlrc . COPY --chown=citus:citus .psqlrc .
# sets default pg version
RUN pgenv switch 13.4

View File

@ -1,5 +1,5 @@
{ {
"image": "citus/devcontainer:dev", "image": "citus/devcontainer:dev-1",
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
"forwardPorts": [9700], "forwardPorts": [9700],
"extensions": [ "extensions": [