Skip to content
Snippets Groups Projects
Commit 8857cf6f authored by nimrod's avatar nimrod
Browse files

Postgres image.

parent dcd0a7c4
No related branches found
No related tags found
No related merge requests found
Pipeline #2801 passed
...@@ -179,3 +179,19 @@ push-youtube-dl: ...@@ -179,3 +179,19 @@ push-youtube-dl:
needs: needs:
- job: build-youtube-dl - job: build-youtube-dl
artifacts: true artifacts: true
# postgres image:
build-postgres:
extends: .container-build
variables:
CONTEXT: postgres
push-postgres:
extends: .container-push
variables:
CONTEXT: postgres
IMAGE: postgres
needs:
- job: build-postgres
artifacts: true
...@@ -66,6 +66,7 @@ repos: ...@@ -66,6 +66,7 @@ repos:
rev: v0.2.0 rev: v0.2.0
hooks: hooks:
- id: shell-validate - id: shell-validate
exclude: postgres/healthcheck
- repo: https://github.com/AleksaC/hadolint-py.git - repo: https://github.com/AleksaC/hadolint-py.git
rev: v2.8.0 rev: v2.8.0
......
FROM docker.io/postgres:14-alpine
COPY --chown=root:root healthcheck /usr/local/bin/
HEALTHCHECK --start-period=3m CMD healthcheck
# postgres
Just the upstream image but with a healthcheck.
#!/usr/bin/env bash
set -eo pipefail
host="$(hostname -i || echo '127.0.0.1')"
user="${POSTGRES_USER:-postgres}"
db="${POSTGRES_DB:-$POSTGRES_USER}"
export PGPASSWORD="${POSTGRES_PASSWORD:-}"
args=(
# force postgres to not use the local unix socket (test "external" connectibility)
--host "$host"
--username "$user"
--dbname "$db"
--quiet --no-align --tuples-only
)
if select="$(echo 'SELECT 1' | psql "${args[@]}")" && [ "$select" = '1' ]; then
exit 0
fi
exit 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment