From cd92377140142088ad0b46b7f1db2976641ebdfc Mon Sep 17 00:00:00 2001 From: Mart van Santen <mart@greenhost.nl> Date: Fri, 26 Nov 2021 10:43:49 +0100 Subject: [PATCH] Make more advanced postgres image --- .gitlab-ci.yml | 18 +++++++++++++----- postgres/Dockerfile | 13 +++++++++++++ postgres/setup.sql | 6 ++++++ 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 postgres/Dockerfile create mode 100644 postgres/setup.sql diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 95f01dd..1386a78 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -88,6 +88,14 @@ login: # - .gitlab-ci.yml +postgres: + stage: build + needs: [] + variables: + KANIKO_CONTEXT: "postgres" + KANIKO_BUILD_IMAGENAME: $CI_JOB_NAME + extends: .kaniko_build + kratos: stage: build needs: [] @@ -114,7 +122,7 @@ hydra: behave-integration: stage: integration-test services: - - name: postgres:latest + - name: ${CI_REGISTRY_IMAGE}/postgres:${CI_COMMIT_REF_NAME} alias: postgres - name: ${CI_REGISTRY_IMAGE}/kratos:${CI_COMMIT_REF_NAME} alias: kratos @@ -153,15 +161,15 @@ behave-integration: PUBLIC_URL: "http://localhost:5000/" DATABASE_URL: "postgres://postgres:postgres@postgres/postgres" # For hydra & kratos - DSN: "postgres://postgres:postgres@postgres/postgres" + DSN: "postgres://hydra:hydra@postgres/hydra" # For hydra URLS_SELF_ISSUER: http://localhost/ URLS_CONSENT: http://oidc:5000/login URLS_LOGIN: http://oidc:5000/consent # For postgres image - POSTGRES_PASSWORD: postgres - POSTGRES_USER: postgres - POSTGRES_DB: postgres +# POSTGRES_PASSWORD: postgres +# POSTGRES_USER: postgres +# POSTGRES_DB: postgres # General flask DEBUG: "true" FLASK_ENV: "development" diff --git a/postgres/Dockerfile b/postgres/Dockerfile new file mode 100644 index 0000000..5bb1e5c --- /dev/null +++ b/postgres/Dockerfile @@ -0,0 +1,13 @@ + + + +# This Dockerfile is only used for testing CI/CD testing and is not used in +# production. + + + +FROM postgres:latest + + +COPY setup.sql /docker-entrypoint-initdb.d/setup.sql + diff --git a/postgres/setup.sql b/postgres/setup.sql new file mode 100644 index 0000000..6231097 --- /dev/null +++ b/postgres/setup.sql @@ -0,0 +1,6 @@ +CREATE USER hydra WITH PASSWORD 'hydra'; +CREATE USER kratos WITH PASSWORD 'kratos'; +CREATE USER stackspin WITH PASSWORD 'stackspin'; +CREATE DATABASE kratos WITH OWNER kratos; +CREATE DATABASE hydra WITH OWNER hydra; +CREATE DATABASE stackspin WITH OWNER stackspin; -- GitLab