Skip to content

Commit 3df6f2a

Browse files
committed
ci: Add docker-build-qns action
Needed for mozilla#3123. Will be a no-op until called from there, hence committing.
1 parent 79f359d commit 3df6f2a

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: 'Build QNS Docker Image'
2+
description: 'Build a Docker image for QNS testing'
3+
author: 'neqo'
4+
5+
inputs:
6+
ref:
7+
description: 'Git ref to checkout (SHA, branch, tag)'
8+
required: false
9+
default: github.ref
10+
tag:
11+
description: 'Tag for the image'
12+
required: false
13+
default: ''
14+
push:
15+
description: 'Whether to push the image to registry'
16+
required: false
17+
default: 'false'
18+
platforms:
19+
description: 'Platforms to build for'
20+
required: false
21+
default: 'linux/amd64'
22+
23+
outputs:
24+
image-id:
25+
description: 'The ID of the built Docker image'
26+
value: ${{ steps.docker_build.outputs.imageID }}
27+
artifact-name:
28+
description: 'The name of the uploaded artifact'
29+
value: ${{ upload.outputs.artifact-name }}
30+
31+
runs:
32+
using: "composite"
33+
steps:
34+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
35+
with:
36+
ref: inputs.ref
37+
persist-credentials: false
38+
39+
- uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
40+
id: meta
41+
with:
42+
images: ghcr.io/${{ github.repository }}-qns${{ inputs.tag }}
43+
tags: |
44+
# default
45+
type=schedule
46+
type=ref,event=branch
47+
type=ref,event=tag
48+
type=ref,event=pr
49+
# set latest tag for default branch
50+
type=raw,value=latest,enable={{is_default_branch}}
51+
52+
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
53+
id: docker_build
54+
with:
55+
push: ${{ inputs.push }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
file: qns/Dockerfile
58+
build-args: RUST_VERSION=stable
59+
platforms: ${{ inputs.platforms }}
60+
outputs: type=docker,dest=/tmp/${{ format('{0}.tar', inputs.tag }}
61+
62+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
63+
id: upload
64+
if: ${{ inputs.push == 'false' }}
65+
with:
66+
name: ${{ format('{0} Docker image ', inputs.tag) }}
67+
path: /tmp/${{ format('{0}.tar', inputs.tag }}

0 commit comments

Comments
 (0)