Skip to content

Commit 10767e4

Browse files
authored
Merge pull request #4 from metacpan/haarg/deploy-image
update deployed image on merge to master
2 parents ef3ba1a + 7ba7b8d commit 10767e4

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

.github/workflows/build-container.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,31 @@ on:
1212
jobs:
1313
docker:
1414
runs-on: ubuntu-22.04
15-
name: Docker Push
15+
name: Docker Build and Push
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Log in to Docker Hub
1919
uses: docker/login-action@v3
2020
with:
2121
username: ${{ secrets.DOCKER_HUB_USER }}
2222
password: ${{ secrets.DOCKER_HUB_TOKEN }}
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
- name: Generate Auth Token
26+
uses: actions/create-github-app-token@v1
27+
id: app-token
28+
with:
29+
app-id: ${{ secrets.APP_ID }}
30+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
2331
- name: Build test image
2432
id: docker-build-test
2533
uses: docker/build-push-action@v5
2634
with:
2735
target: test
2836
push: false
37+
load: true
38+
cache-from: type=gha
39+
cache-to: type=gha,mode=max
2940
- name: Run Perl tests
3041
run: docker run -i ${{ steps.docker-build-test.outputs.imageid }}
3142
- name: Docker meta
@@ -46,5 +57,14 @@ jobs:
4657
push: true
4758
tags: ${{ steps.meta.outputs.tags }}
4859
annotations: ${{ steps.meta.outputs.annotations }}
49-
- if: contains( fromJSON(steps.meta.outputs.json).tags, "${{ github.repository }}:latest")
50-
run: echo 'need update to ${{ fromJSON(steps.meta.outputs.json).tags[0] }}'
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max
62+
- name: Update deployed image
63+
if: ${{ contains( fromJSON(steps.meta.outputs.json).tags, format('{0}:latest', github.repository)) }}
64+
uses: benc-uk/workflow-dispatch@v1
65+
with:
66+
repo: metacpan/metacpan-k8s
67+
ref: main
68+
workflow: set-image.yml
69+
token: ${{ steps.app-token.outputs.token }}
70+
inputs: '{ "app": "api-v0-shim", "environment": "prod", "base-tag": "${{ github.repository }}:latest", "tag": "${{ fromJSON(steps.meta.outputs.json).tags[0] }}" }'

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ COPY cpanfile cpanfile.snapshot ./
99
RUN \
1010
--mount=type=cache,target=/root/.perl-cpm,sharing=private \
1111
<<EOT /bin/bash -euo pipefail
12-
cpm install --show-build-log-on-failure
12+
cpm install --show-build-log-on-failure --resolver=snapshot
1313
EOT
1414

1515
ENV PERL5LIB="/metacpan-api-v0-shim/lib:/metacpan-api-v0-shim/local/lib/perl5"

0 commit comments

Comments
 (0)