- go to the db-dockerfile directory
- build and tag the image with "docker build . -t name-of-your-image". I used paoliniluis/app-db-with-certs:postgres-14.3-alpine
- then go to the docker-compose file and include the name of the image you just built and tagged in line 16
- do a docker-compose up (things won't run, this is only to extract the certificates from the db container)
- do the following (to copy the certificates):
- docker cp postgres-app-db-with-certs:/var/lib/postgresql/certs/ca.crt metabase-dockerfile/app-db/ca.crt
- docker cp postgres-app-db-with-certs:/var/lib/postgresql/certs/client.crt metabase-dockerfile/app-db/client.crt
- docker cp postgres-app-db-with-certs:/var/lib/postgresql/keys/client.der metabase-dockerfile/app-db/client.der
- now kill the containers and remove the image that was created for the metabase container (docker rmi postgres-with-certs_metabase-with-certs)
- now do docker-compose up again (this will rebuild the Metabase image with the client certificates inside and will authenticate with those)
- put some more automation to this