Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Sam/gh action docker (#53)
Browse files Browse the repository at this point in the history
* feat: updating gh action for docker image build and push to registry

* feat: add ds magic-cache-action

* chore: tmp settings on action to run on pr

* fix: fix steps

* fix: docker gh action

* fix: perms

* fix: pr

* fix: perms

* fix: build invocation

* fix: docker registry invocation

* fix: invocation correction

* fix: now set up ci to only build and push docker images on merge of main
  • Loading branch information
samrose authored Mar 8, 2024
1 parent 1bc138d commit 807ba80
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,24 @@ env:

jobs:
build:
strategy:
fail-fast: false
matrix:
runner: [ "X64", "arm-runner" ]
name: "update: build and deploy postgres server images"
runs-on: [ self-hosted, "${{ matrix.runner }}" ]
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
packages: write
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
fetch-depth: 0
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: actions/checkout@v3

- name: Build images
run: |
nix build .#psql_15/docker -o result-docker-15
nix build .#psql_16/docker -o result-docker-16
nix build .#psql_orioledb_16/docker -o result-docker-orioledb-16
- name: Tag images
run: |
set -x
for x in 14 15; do
docker load -i result-docker-$x
docker tag postgresql-$x:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-$x:${GITHUB_SHA}
docker tag postgresql-$x:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-$x:latest
done
- name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
Expand All @@ -51,7 +38,6 @@ jobs:
- name: Push image to the Container registry
run: |
set -x
for x in 14 15; do
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-$x:${GITHUB_SHA}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-$x:latest
for x in 15 16 orioledb_16; do
nix build .#psql_$x/docker.copyToRegistry
done

0 comments on commit 807ba80

Please sign in to comment.