-
Notifications
You must be signed in to change notification settings - Fork 38
159 lines (141 loc) · 5.96 KB
/
docker-build.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: docker-build
on:
workflow_dispatch:
schedule:
- cron: '5 0 * * 6'
pull_request:
paths:
- 'ci/docker/*'
- '.github/workflows/docker-build.yaml'
- 'docker-compose.yaml'
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build-docker:
name: "${{ matrix.config.service }}-${{ matrix.config.platform }}-${{ matrix.config.arch }}"
runs-on: ${{ matrix.config.runs_on }}
strategy:
fail-fast: false
matrix:
config:
- { runs_on: "ubuntu-latest", platform: "ubuntu", arch: "amd64", service: "verify" }
- { runs_on: "ubuntu-latest", platform: "fedora", arch: "amd64", service: "verify" }
- { runs_on: "ubuntu-latest", platform: "archlinux", arch: "amd64", service: "verify" }
- { runs_on: "ubuntu-latest", platform: "alpine", arch: "amd64", service: "verify" }
- { runs_on: ["self-hosted", "arm"], platform: "ubuntu", arch: "arm64", service: "verify" }
- { runs_on: ["self-hosted", "arm"], platform: "fedora", arch: "arm64", service: "verify" }
- { runs_on: ["self-hosted", "arm"], platform: "alpine", arch: "arm64", service: "verify" }
- { runs_on: "ubuntu-latest", platform: "alpine", arch: "s390x", service: "verify" }
env:
DOCKER_CLIENT_TIMEOUT: 360
COMPOSE_HTTP_TIMEOUT: 360
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Create Docker Context for Buildx
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: builders
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: matrix.config.arch == 's390x'
uses: docker/setup-qemu-action@v3
- name: Build
env:
NANOARROW_ARCH: ${{ matrix.config.arch }}
NANOARROW_PLATFORM: ${{ matrix.config.platform }}
DOCKER_DEFAULT_PLATFORM: "linux/${{ matrix.config.arch }}"
run: |
docker compose build verify || docker-compose build verify
- name: Push
if: ${{ github.event_name != 'pull_request' && github.repository == 'apache/arrow-nanoarrow'}}
env:
NANOARROW_ARCH: ${{ matrix.config.arch }}
NANOARROW_PLATFORM: ${{ matrix.config.platform }}
DOCKER_DEFAULT_PLATFORM: "linux/${{ matrix.config.arch }}"
run: |
docker compose push ${{ matrix.config.service }} || \
docker-compose push ${{ matrix.config.service }}
# Build some arch-agnostic images for non-verify docker bits
build-docker-manifest:
runs-on: ubuntu-latest
needs: build-docker
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
docker manifest create \
ghcr.io/apache/arrow-nanoarrow:ubuntu \
ghcr.io/apache/arrow-nanoarrow:ubuntu-amd64 \
ghcr.io/apache/arrow-nanoarrow:ubuntu-arm64
docker manifest annotate \
ghcr.io/apache/arrow-nanoarrow:ubuntu \
ghcr.io/apache/arrow-nanoarrow:ubuntu-amd64 --arch amd64
docker manifest annotate \
ghcr.io/apache/arrow-nanoarrow:ubuntu \
ghcr.io/apache/arrow-nanoarrow:ubuntu-arm64 --arch arm64
docker manifest create \
ghcr.io/apache/arrow-nanoarrow:fedora \
ghcr.io/apache/arrow-nanoarrow:fedora-amd64 \
ghcr.io/apache/arrow-nanoarrow:fedora-arm64
docker manifest annotate \
ghcr.io/apache/arrow-nanoarrow:fedora \
ghcr.io/apache/arrow-nanoarrow:fedora-amd64 --arch amd64
docker manifest annotate \
ghcr.io/apache/arrow-nanoarrow:fedora \
ghcr.io/apache/arrow-nanoarrow:fedora-arm64 --arch arm64
docker manifest create \
ghcr.io/apache/arrow-nanoarrow:alpine \
ghcr.io/apache/arrow-nanoarrow:alpine-amd64 \
ghcr.io/apache/arrow-nanoarrow:alpine-arm64 \
ghcr.io/apache/arrow-nanoarrow:alpine-s390x
docker manifest annotate \
ghcr.io/apache/arrow-nanoarrow:alpine \
ghcr.io/apache/arrow-nanoarrow:alpine-amd64 --arch amd64
docker manifest annotate \
ghcr.io/apache/arrow-nanoarrow:alpine \
ghcr.io/apache/arrow-nanoarrow:alpine-arm64 --arch arm64
docker manifest annotate \
ghcr.io/apache/arrow-nanoarrow:alpine \
ghcr.io/apache/arrow-nanoarrow:alpine-s390x --arch s390x
- name: Push
if: ${{ github.event_name != 'pull_request' && github.repository == 'apache/arrow-nanoarrow'}}
run: |
docker manifest push ghcr.io/apache/arrow-nanoarrow:ubuntu
docker manifest push ghcr.io/apache/arrow-nanoarrow:fedora
docker manifest push ghcr.io/apache/arrow-nanoarrow:alpine