Skip to content

Commit 4175eb8

Browse files
authored
HADOOP-19324. Publish hadoop image to GitHub Container Registry (#7143)
1 parent 185fd5f commit 4175eb8

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: build-hadoop-image
17+
18+
# This workflow builds the Hadoop docker image.
19+
# For non-PR runs, it also pushes the image to the registry, tagging it based on the branch name.
20+
21+
on:
22+
pull_request:
23+
types: [opened, synchronize]
24+
branches:
25+
- 'docker-hadoop-**'
26+
- '!docker-hadoop-runner-**'
27+
push:
28+
branches:
29+
- 'docker-hadoop-**'
30+
- '!docker-hadoop-runner-**'
31+
32+
permissions:
33+
contents: read
34+
packages: write
35+
36+
jobs:
37+
build:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Generate image ID
41+
id: meta
42+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
43+
with:
44+
images: |
45+
ghcr.io/${{ github.repository_owner }}/hadoop
46+
tags: |
47+
type=match,pattern=docker-hadoop-(.*),value={{branch}},group=1
48+
flavor: |
49+
latest=false
50+
51+
- name: Login to ghcr.io
52+
id: login
53+
if: ${{ github.event_name != 'pull_request' }}
54+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
55+
with:
56+
registry: ghcr.io
57+
username: ${{ github.repository_owner }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Build and push image
61+
id: build
62+
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
63+
with:
64+
platforms: linux/amd64
65+
push: ${{ github.event_name != 'pull_request' }}
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)