forked from sxs-collaboration/spectre
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (81 loc) · 2.63 KB
/
BuildDockerContainer.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Distributed under the MIT License.
# See LICENSE.txt for details.
# This workflow can be run manually on any branch to build and push our Docker
# containers.
name: Build Docker container
on:
workflow_dispatch:
inputs:
image_name:
description: >
Image name to push to DockerHub
required: true
default: 'sxscollaboration/spectre'
build_arm:
type: boolean
description: >
Build ARM container in addition to x86_64
default: true
jobs:
build_container:
name: Build and deploy
runs-on: ubuntu-latest
# This environment can be protected to require manual approval before
# deployment. On forks where you set your own secrets for authentication
# with DockerHub you can choose not to protect this environment.
environment: deploy-containers
strategy:
fail-fast: true
matrix:
include:
# Development container for building and testing
- ubuntu_version: "22.04"
platforms: >
${{ inputs.build_arm && 'linux/amd64,linux/arm64'
|| 'linux/amd64' }}
tag: "dev"
# Container for deploying static execs
- ubuntu_version: "18.04"
platforms: "linux/amd64"
tag: "dev1804"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up emulation support
if: inputs.build_arm
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# We could also push containers to GitHub instead of DockerHub
# - name: Login to GitHub container registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Build dev container
uses: docker/build-push-action@v5
with:
push: true
context: .
file: "./containers/Dockerfile.buildenv"
target: dev
tags: ${{ inputs.image_name }}:${{ matrix.tag }}
platforms: ${{ matrix.platforms }}
build-args: |
PARALLEL_MAKE_ARG=-j4
UBUNTU_VERSION=${{ matrix.ubuntu_version}}
run_tests:
name: Test
uses: ./.github/workflows/Tests.yaml
needs: build_container
secrets: inherit
with:
container: ${{ inputs.image_name }}:dev