Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/build-database-init.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Push Docker image to GHCR

on:
push:
branches:
- main
paths:
- "pg/**"
- "Dockerfile-database-init"
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Comment thread
marccyprien marked this conversation as resolved.

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/vao-database-init
tags: |
type=sha,prefix=sha-
type=ref,event=branch
type=raw,value=latest,enable={{is_default_branch}}
Comment thread
marccyprien marked this conversation as resolved.

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-database-init
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
7 changes: 7 additions & 0 deletions Dockerfile-database-init
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM postgres:17.5-alpine

COPY pg/ /pg/
Comment thread
marccyprien marked this conversation as resolved.

RUN chmod +x /pg/entrypoint.sh

ENTRYPOINT ["/pg/entrypoint.sh"]
Loading