Added docker multistage build#25
Added docker multistage build#25datensalat wants to merge 1 commit intodf7cb:masterfrom datensalat:master
Conversation
|
|
||
| WORKDIR /opt/postgresql-unit | ||
|
|
||
| RUN curl -fsSL https://github.com/df7cb/postgresql-unit/archive/$PG_UNIT_VERSION.tar.gz | \ |
There was a problem hiding this comment.
Hi,
why isn't this using the files from the very git repository you want to have this merged into? Pulling a (versioned) tarball from github instead doesn't seem right.
Alternatively, couldn't you just "apt-get install postgresql-$PG_VERSION-unit" instead?
Christoph
There was a problem hiding this comment.
D'oh! My mistake...
I didn't check the postgresql repos for your unit extension, just the ubuntu repos :(
Through the docker build, you get the flexibility to test different releases of your extension with different distros and psql versions, but the fact, that the extension is available in the psql apt repo ist making this pull request nearly obsolete...
Nevertheless a Docker Hub Image would be nice and is easily possible with this Dockerfile.
|
|
||
| FROM postgres:11 | ||
|
|
||
| COPY --from=0 /opt/postgresql-unit/unit.so /usr/lib/postgresql/$PG_MAJOR/lib/ |
There was a problem hiding this comment.
Why does it run make install when it then proceeds to fetch the files from /opt?
There was a problem hiding this comment.
make install is just for checking that the package installs right - indeed not necessary.
Should be commented out, I used it just for development purposes.
|
I'm currently using this FROM postgres:12 AS extension_builder
RUN apt-get update -y
RUN apt-get install wget -y
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get install postgresql-12-unit -y
FROM postgres:12
COPY --from=extension_builder /usr/lib/postgresql/12/lib /usr/lib/postgresql/12/lib
COPY --from=extension_builder /usr/share/postgresql/12/extension /usr/share/postgresql/12/extensionbased on the suggestion(s) here docker-library/postgres#340 (comment) Just wondering if there are any glaring problems with this approach? Thanks! |
|
Thanks a lot @johnrees This is my current working FROM postgres:18 AS extension_builder
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends wget gnupg \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends postgresql-18-unit \
&& rm -rf /var/lib/apt/lists/*
FROM postgres:18
COPY --from=extension_builder /usr/lib/postgresql/18/lib /usr/lib/postgresql/18/lib
COPY --from=extension_builder /usr/share/postgresql/18/extension /usr/share/postgresql/18/extension |
Hey there, I added an easy docker approach for testing your extension.