Skip to content

Commit 357c203

Browse files
committed
Initial commit: PostgreSQL 15 with pg_cron
0 parents  commit 357c203

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'Dockerfile'
8+
- '.github/workflows/docker-publish.yml'
9+
workflow_dispatch:
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: eigenwallet/postgres-pgcron
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Log in to Container Registry
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=raw,value=15
46+
type=raw,value=latest
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
platforms: linux/amd64,linux/arm64
53+
push: true
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM postgres:15
2+
3+
LABEL org.opencontainers.image.source="https://github.com/eigenwallet/postgres-pgcron"
4+
LABEL org.opencontainers.image.description="PostgreSQL 15 with pg_cron extension"
5+
LABEL org.opencontainers.image.licenses="MIT"
6+
7+
RUN apt-get update \
8+
&& apt-get install -y --no-install-recommends postgresql-15-cron \
9+
&& rm -rf /var/lib/apt/lists/*

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# postgres-pgcron
2+
3+
PostgreSQL 15 Docker image with the [pg_cron](https://github.com/citusdata/pg_cron) extension pre-installed.
4+
5+
## Usage
6+
7+
```bash
8+
docker pull ghcr.io/eigenwallet/postgres-pgcron:15
9+
```
10+
11+
### Docker Compose
12+
13+
```yaml
14+
services:
15+
db:
16+
image: ghcr.io/eigenwallet/postgres-pgcron:15
17+
environment:
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: postgres
20+
POSTGRES_DB: mydb
21+
command: >
22+
postgres
23+
-c shared_preload_libraries=pg_cron
24+
-c cron.database_name=mydb
25+
```
26+
27+
### Docker Run
28+
29+
```bash
30+
docker run -d \
31+
-e POSTGRES_USER=postgres \
32+
-e POSTGRES_PASSWORD=postgres \
33+
-e POSTGRES_DB=mydb \
34+
-p 5432:5432 \
35+
ghcr.io/eigenwallet/postgres-pgcron:15 \
36+
postgres \
37+
-c shared_preload_libraries=pg_cron \
38+
-c cron.database_name=mydb
39+
```
40+
41+
### Enable pg_cron in your database
42+
43+
```sql
44+
CREATE EXTENSION IF NOT EXISTS pg_cron;
45+
```
46+
47+
## Building locally
48+
49+
```bash
50+
docker build -t postgres-pgcron:15 .
51+
```

0 commit comments

Comments
 (0)