-
Notifications
You must be signed in to change notification settings - Fork 11
75 lines (64 loc) · 2.19 KB
/
vcpkg_docker_amd64.yml
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
name: Docker Build Images (AMD64)
env:
# Also remember to change the 'docker/build.sh' script
IMAGE_VER: "v2"
on:
schedule:
# Once every Wednesday at 00:00
- cron: '0 0 * * 3'
push:
branches:
- master
paths:
- 'docker/**'
- '.github/workflows/vcpkg_docker_amd64.yml'
pull_request:
paths:
- 'docker/**'
- '.github/workflows/vcpkg_docker_amd64.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
# arch is to tag docker images for uniqueness
host:
- { name: 'ubuntu-22.04', arch: '' }
container:
- { version: '22.04', codename: 'jammy' }
runs-on: ${{ matrix.host.name }}
permissions:
packages: write
contents: read
steps:
- name: Cleanup working directory with container root
run: |
docker run --rm -v $(pwd):/workspace -w /workspace ubuntu:latest find . -name . -o -prune -exec rm -rf -- {} + || true
- uses: actions/checkout@v4
- name: Generate Image Name
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
test_name=""
if [[ "${GITHUB_REF}" != "refs/heads/master" ]] ; then
test_name="test-${BRANCH_NAME////_}-"
fi
echo "IMAGE_NAME=ghcr.io/lifting-bits/cxx-common/${test_name}vcpkg-builder-ubuntu-${{ env.IMAGE_VER }}:${{ matrix.container.version }}${{ matrix.host.arch }}" >> ${GITHUB_ENV}
- name: Build image
working-directory: docker
run: |
# Pull freshest ubuntu Docker image
docker pull ubuntu:${{ matrix.container.version}}
docker build -f Dockerfile.ubuntu.vcpkg \
--no-cache \
--target caching \
--build-arg "DISTRO_VERSION=${{ matrix.container.codename }}" \
-t "${IMAGE_NAME}" \
.
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: docker push "${IMAGE_NAME}"