Sign inSign up

greuceanu/psql

By greuceanu

•Updated over 3 years ago

A simple image to run PostgreSQL jobs for multiple architectures using psql, including Raspberry Pi.

Image
1

226

greuceanu/psql repository overview

⁠psql

A simple and lightweight image to run PostgreSQL jobs which can be build for multiple architectures (including for RaspberryPi) using psql - the PostgreSQL interactive terminal.

This is the image source code for the greuceanu/psql⁠ repository.

⁠Usage

As you want - don't forget to specify the command/entrypoint (check examples).

⁠Examples
⁠Simple psql call for k8s

Assumes that config map, secrets and deployment objects are already created:

---
#
# Job which runs init script
#
apiVersion: batch/v1
kind: Job
metadata:
  name: pgsql-init-sql
  namespace: ns
spec:
  template:
    spec:
      volumes:
      - name: init-sql
        configMap:
          name: pgsql-config
      containers:
      - name: pgsql-create-users
        image: greuceanu/psql:latest
        env:
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              name: pgsql-secrets
              key: POSTGRES_PASSWORD
        - name: PGUACD_PASSWORD
          valueFrom:
            secretKeyRef:
              name: pgsql-secrets
              key: PGUACD_PASSWORD
        command:
        - sh
        - -c
        - |
          until pg_isready -h pgsql -U postgres; do
            sleep 1
          done
          psql "host=pgsql user=postgres password=$POSTGRES_PASSWORD" -f /mnt/init.sql
        volumeMounts:
        - name: init-sql
          mountPath: /mnt
      restartPolicy: OnFailure
  backoffLimit: 4

Tag summary

Content type

Image

Digest

sha256:fb385abba…

Size

7.6 MB

Last updated

over 3 years ago

docker pull greuceanu/psql