postgres-containers icon indicating copy to clipboard operation
postgres-containers copied to clipboard

WIP: add Alpine Dockerfile

Open sando38 opened this issue 1 year ago • 5 comments

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!

sando38 avatar Mar 01 '24 22:03 sando38

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.

shusaan avatar Mar 12 '24 01:03 shusaan

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.

sando38 avatar Mar 12 '24 01:03 sando38

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?

shusaan avatar Mar 12 '24 01:03 shusaan

Yes, that is correct.

sando38 avatar Mar 12 '24 01:03 sando38

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

ramijebara avatar Sep 27 '24 17:09 ramijebara