This repository was archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
88 lines (76 loc) · 2.7 KB
/
build-docker.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
76
77
78
79
80
81
82
83
84
85
86
87
name: Docker image build
on:
workflow_call:
inputs:
cuda_compiler_version:
type: string
default: None
name:
type: string
default: cpu
options:
type: string
default: -DENABLE_CUDA=off
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Free space
run: |
sudo rm -rf /usr/local/lib/android/sdk /opt/hostedtoolcache /usr/share/swift /opt/az
sudo apt-get purge -y gcc llvm-12 llvm-13 llvm-14
- name: Set env context
run: |
echo RUN_STAMP=docker-${{ runner.os }}-${{ inputs.name }} >>$GITHUB_ENV
cat omniscidb/docker/dev/Dockerfile omniscidb/docker/dev/Dockerfile.${{ inputs.name }} >Dockerfile
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build image
uses: docker/build-push-action@v3
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: Dockerfile
push: false
load: true
tags: build.${{ inputs.name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# https://github.com/docker/build-push-action/issues/252
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Start the container
run: |
mkdir -p build
docker run -id --name build.${{ inputs.name }} --network host -v $(pwd):/_work build.${{ inputs.name }}:latest
- name: Configure and build the project
run: |
docker exec -u ghrunner build.${{ inputs.name }} dpkg -l
docker exec -u ghrunner build.${{ inputs.name }} sh /_work/omniscidb/scripts/conda/build.sh ${{ inputs.options }}
docker exec -u ghrunner build.${{ inputs.name }} tar -zcf /tmp/build.tgz -C /_work .
docker cp build.${{ inputs.name }}:/tmp/build.tgz .
- name: Upload build and src files
uses: actions/upload-artifact@v3
with:
name: ${{ env.RUN_STAMP }}-build
path: build.tgz
- name: Upload logs
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ env.RUN_STAMP }}-logs
path: |
build/*.log
build/CMakeCache.txt
build/CMakeFiles/*.log