-
Notifications
You must be signed in to change notification settings - Fork 58
61 lines (54 loc) · 1.75 KB
/
rocky_container_image.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
name: Rocky Create container image
on:
push:
paths:
- octopoes/**
- rocky/**
- .github/workflows/rocky_container_image.yml
pull_request:
paths:
- octopoes/**
- rocky/**
- .github/workflows/rocky_container_image.yml
jobs:
create_container_image:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/nl-kat-rocky
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate version.py
run: |
pip install setuptools-scm==7.1.0
python -m setuptools_scm
cp _version.py rocky/rocky/version.py
- name: Build container image
uses: docker/build-push-action@v4
with:
# We don't use git context because that doesn't process .dockerignore
# https://github.com/docker/cli/issues/2827
context: .
file: rocky/Dockerfile
push: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max