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

WIP: add Alpine Dockerfile #94

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sando38
Copy link

@sando38 sando38 commented Mar 1, 2024

Hello hello,

I took the freedom to create an Alpine based Dockerfile. It is WIP. The only file which should be reviewed is ./Alpine/16/Dockerfile.

This should fix #78

The Dockerfile is not yet 100% optimized in terms of Docker best practices. And image size, hence, I used a trick to copy everything into a SCRATCH base image in the end, but that could be improved, if the image works as intended.

I tested:

  • Bootstrapping: InitDB, recovery, pg_basebackup
  • Replica mode set to true and promotion
  • Scheduled backups
  • Barman cloud backup for WAL

I uploaded the image also in Dockerhub, so you do not need to build it yourself :)

docker pull  docker.io/sando38/cnpg-postgres:16.2-1-alpine

ToDos:

  • Integrate into the CI process/ repository structure
  • Test other Postgres versions <16
  • Test other scenarios I haven't tested yet
  • Test performance of the image variant

Let me know what you think!

Postgres client is already included in the base image.
@shusaan
Copy link

shusaan commented Mar 12, 2024

Hi @sando38 Thank for awesome work, If you check the alpine packages registry, there is "barman" package available,
what your opinion about use that packages from registry or compile from source is best option.

@sando38
Copy link
Author

sando38 commented Mar 12, 2024

Thanks for the feedback.

I compiled barman from source to avoid the installation of unrequired dependencies as the postgres base image contains them already. And I wanted to avoid, that a potential incompatible version of pg-client is being installed by the barman package, plus the package is only in the edge repository.

@shusaan
Copy link

shusaan commented Mar 12, 2024

Thanks for the feedback.

I compiled barman from source to avoid the installation of unrequired dependencies as the postgres base image contains them already. And I wanted to avoid, that a potential incompatible version of pg-client is being installed by the barman package, plus the package is only in the edge repository.

Thank you @sando38
If I want to use this image that you have published for testing purpose, i have to refer this image and then install other packages, like this one

FROM docker.io/sando38/cnpg-postgres:16.2-1-alpine
USER root
RUN apk add timescaledb OR Compile from source (use multi stage build)
USER 26

right?

@sando38
Copy link
Author

sando38 commented Mar 12, 2024

Yes, that is correct.

@ramijebara
Copy link

Are there any updates on this PR? This is good work!

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.

Support alpine images
3 participants