Docker image containing a PostgreSQL database and a schema migrator to simplify database schema upgrades.
mvn clean install
From the top-level directory, run the following command to copy the build assets to the target directory:
mvn compile
Then go to the target directory and invoke Docker build as shown here:
pushd target/docker
docker build . --tag localhost.localdomain/postgresql-container:latest --no-cache
popd
Use the following command to the start the Database in a background docker container:
docker run -p 5432:5432 --name postgres -d localhost.localdomain/postgresql-container:latest
Use the following JDBC URL to connect to the database:
jdbc:postgresql://localhost:5432/postgres
To extend the schema definition with the tables, data, etc, simply add new idempotent SQL scripts to the
src/main/resources/db/migration/
folder.
The SQL script file names must follow the pattern
SPRINT<zero padded three digit sprint number>_<zero padded two digit script order number>__<description>.sql
as shown in this example: SPRINT001_01__Initial_database_revision.sql
.
- PostgreSQL
- Flyway
- postgres - Docker Official Images
- Docker Library PostgreSQL on GitHub
- "exec: "docker-entrypoint.sh": executable file not found in $PATH". #296
- Sending RUN ["docker-entrypoint.sh", "postgres", "--version"] output to the console during the build #718
- Functionalize the entrypoint to allow outside sourcing for extreme customizing of startup #496