Skip to content

Commit 2d3fa89

Browse files
authored
Build custom image for postgres db (#57)
* Build custom image for postgres db * Build custom image for postgres db
1 parent 00999fd commit 2d3fa89

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and publish postgres image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- scripts/postgres-db.Dockerfile
10+
- .github/workflows/build-publish-postgres-ghcr.yml
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
concurrency:
17+
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
18+
cancel-in-progress: false
19+
20+
permissions:
21+
packages: write
22+
23+
jobs:
24+
build-publish-image:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v5
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
with:
32+
platforms: arm64
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
with:
37+
install: true
38+
39+
- name: Login to ghcr
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Build and push images
47+
uses: docker/build-push-action@v6
48+
with:
49+
file: scripts/postgres-db.Dockerfile
50+
context: scripts
51+
platforms: linux/amd64,linux/arm64
52+
push: true
53+
load: false
54+
tags: ghcr.io/${{ github.repository_owner }}/postgres-17-perf:${{ github.ref_name }}

scripts/postgres-db.Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM postgres:17
2+
COPY dbdata/*.sql /docker-entrypoint-initdb.d
3+
EXPOSE 5432
4+
5+
ENV POSTGRES_USER=fruits \
6+
POSTGRES_PASSWORD=fruits \
7+
POSTGRES_DB=fruits

0 commit comments

Comments
 (0)