-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.83 KB
/
test.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
name: Test Build & Run
on:
pull_request:
permissions:
contents: read
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Set version
# Set a random release version
run: |
echo "RELEASE_VERSION=$(tr -dc 0-9 </dev/urandom | head -c 4)" >> $GITHUB_ENV
- name: Set up Docker Buildx #must be executed before a step that contains platforms
uses: docker/setup-buildx-action@v2
- name: Build base image for multiple platforms
# Need to build for 2 platforms in 2 stages even though --platform=linux/amd64,linux/arm64 is possible.
# This is because --load isn't compatible when multiple args are passed to --platform.
# https://github.com/docker/buildx/issues/59
# We want --load to save the image to local registry.
run: |
docker buildx build --load --platform linux/arm64 -t flanksource/base-image:${{ env.RELEASE_VERSION }} .
docker buildx build --load --platform linux/amd64 -t flanksource/base-image:${{ env.RELEASE_VERSION }} .
- name: Run the container
run: |
docker run --pull=never --rm flanksource/base-image:${{ env.RELEASE_VERSION }} echo 'hello world'
- name: Build canary checker base image for multiple platforms
run: |
docker buildx build --load --platform linux/arm64 -f Dockerfile.canary-checker -t flanksource/base-image-canary-checker:${{ env.RELEASE_VERSION }} .
docker buildx build --load --platform linux/amd64 -f Dockerfile.canary-checker -t flanksource/base-image-canary-checker:${{ env.RELEASE_VERSION }} .
- name: Run the container
run: |
docker run --pull=never --rm flanksource/base-image-canary-checker:${{ env.RELEASE_VERSION }} echo 'hello world'