You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Someone asked how to use this extension with testcontainers a while back and I had a very long-winded answer (but with sample code!)... then realized I was an idiot and there's a much easier answer that can be added to the wiki.
The initialization script can load the jars you require, perform any required SQL calls, etc.
Note: I strongly recommend that any initialization scripts be limited to preparing the test data. Any custom
extensions (UDF, UDT, etc.) should be set up using a SQL Deployment Descriptor bundled in your jar(s). This ensures the SQL extensions and your java implementation remain in sync.
You may not need the withImagePullPolicy() call - I might only need it since I'm developing the docker images locally.
Using an official PostgreSQL image
The short answer is that you can't. The initialization scripts can't install system packages.
The long answer is that you could - but it would be difficult. You would need to install pl/java using the Container#withCommand(String) command once the database container is running. That's a multistep process
even if you're taking advantage of the existing Debian packages available on the official PostgreSQL image.
If you're feeling bold look at the first two targets in this Dockerfile.
The text was updated successfully, but these errors were encountered:
Where were you thinking this would go in the wiki? A new "Using a pre-configured Docker image" page? Or were you thinking it would belong on some existing page?
Or would you like to host these instructions somewhere on a site or blog you control, and have me add a link on the "Prebuilt packages" wiki page where your Docker images are linked already?
Someone asked how to use this extension with testcontainers a while back and I had a very long-winded answer (but with sample code!)... then realized I was an idiot and there's a much easier answer that can be added to the wiki.
Using a pre-configured Docker image
When I'm using my custom docker images I use
The key is the
asCompatibleSubstituteFor()
call.The initialization script can load the jars you require, perform any required SQL calls, etc.
Note: I strongly recommend that any initialization scripts be limited to preparing the test data. Any custom
extensions (UDF, UDT, etc.) should be set up using a SQL Deployment Descriptor bundled in your jar(s). This ensures the SQL extensions and your java implementation remain in sync.
You may not need the
withImagePullPolicy()
call - I might only need it since I'm developing the docker images locally.Using an official PostgreSQL image
The short answer is that you can't. The initialization scripts can't install system packages.
The long answer is that you could - but it would be difficult. You would need to install pl/java using the
Container#withCommand(String)
command once the database container is running. That's a multistep processeven if you're taking advantage of the existing Debian packages available on the official PostgreSQL image.
If you're feeling bold look at the first two targets in this Dockerfile.
The text was updated successfully, but these errors were encountered: