From 8c55995a8f401bf390f1a0d72477515bf90e5c47 Mon Sep 17 00:00:00 2001 From: Unbreathable <70802809+Unbreathable@users.noreply.github.com> Date: Mon, 10 Nov 2025 20:33:43 +0100 Subject: [PATCH] feat(database): Make the postgres image declarable using MAGIC_POSTGRES_IMAGE --- mrunner/runner_deploy.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mrunner/runner_deploy.go b/mrunner/runner_deploy.go index beb8cf6..9d1db94 100644 --- a/mrunner/runner_deploy.go +++ b/mrunner/runner_deploy.go @@ -171,12 +171,18 @@ func (r *Runner) createDatabaseContainer(ctx context.Context, dbType mconfig.Pla Mounts: mounts, } + // Check if an environment variable is set for the postgres image + postgresImage := os.Getenv("MAGIC_POSTGRES_IMAGE") + if postgresImage == "" { + postgresImage = "postgres:latest" + } + // Create the container resp, err := r.client.ContainerCreate(ctx, &container.Config{ - Image: "postgres:latest", + Image: postgresImage, Env: []string{ fmt.Sprintf("POSTGRES_PASSWORD=%s", mconfig.DefaultPassword(dbType.Type)), - fmt.Sprintf("POSTGRES_USERNAME=%s", mconfig.DefaultUsername(dbType.Type)), + fmt.Sprintf("POSTGRES_USER=%s", mconfig.DefaultUsername(dbType.Type)), "POSTGRES_DATABASE=postgres", }, ExposedPorts: exposedPorts,