Loading .gitlab-ci.yml +16 −0 Original line number Diff line number Diff line Loading @@ -179,3 +179,19 @@ push-youtube-dl: needs: - job: build-youtube-dl 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 .pre-commit-config.yaml +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ repos: rev: v0.2.0 hooks: - id: shell-validate exclude: postgres/healthcheck - repo: https://github.com/AleksaC/hadolint-py.git rev: v2.8.0 Loading postgres/Dockerfile 0 → 100644 +3 −0 Original line number Diff line number Diff line FROM docker.io/postgres:14-alpine COPY --chown=root:root healthcheck /usr/local/bin/ HEALTHCHECK --start-period=3m CMD healthcheck postgres/README.md 0 → 100644 +3 −0 Original line number Diff line number Diff line # postgres Just the upstream image but with a healthcheck. postgres/healthcheck 0 → 100755 +21 −0 Original line number Diff line number Diff line #!/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 Loading
.gitlab-ci.yml +16 −0 Original line number Diff line number Diff line Loading @@ -179,3 +179,19 @@ push-youtube-dl: needs: - job: build-youtube-dl 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
.pre-commit-config.yaml +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ repos: rev: v0.2.0 hooks: - id: shell-validate exclude: postgres/healthcheck - repo: https://github.com/AleksaC/hadolint-py.git rev: v2.8.0 Loading
postgres/Dockerfile 0 → 100644 +3 −0 Original line number Diff line number Diff line FROM docker.io/postgres:14-alpine COPY --chown=root:root healthcheck /usr/local/bin/ HEALTHCHECK --start-period=3m CMD healthcheck
postgres/README.md 0 → 100644 +3 −0 Original line number Diff line number Diff line # postgres Just the upstream image but with a healthcheck.
postgres/healthcheck 0 → 100755 +21 −0 Original line number Diff line number Diff line #!/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