Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docker multistage build #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added docker multistage build #25

wants to merge 1 commit into from

Conversation

datensalat
Copy link

Hey there, I added an easy docker approach for testing your extension.


WORKDIR /opt/postgresql-unit

RUN curl -fsSL https://github.com/df7cb/postgresql-unit/archive/$PG_UNIT_VERSION.tar.gz | \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it run make install when it then proceeds to fetch the files from /opt?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@johnrees
Copy link

I'm currently using this Dockerfile

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/extension

based on the suggestion(s) here docker-library/postgres#340 (comment)

Just wondering if there are any glaring problems with this approach? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants