-
Notifications
You must be signed in to change notification settings - Fork 5
127 lines (111 loc) · 4.14 KB
/
Copy path_container.yml
File metadata and controls
127 lines (111 loc) · 4.14 KB
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
on:
workflow_call:
inputs:
publish:
type: boolean
description: If true, pushes image to container registry
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
# Need this to get version number from last tag
fetch-depth: 0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
################################
# Hyperion Container Image Build
################################
- name: Build and export to Docker local cache
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: Dockerfile.hyperion
load: true
- name: Create tags for publishing Hyperion image
id: meta-hyperion
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
labels: |
org.opencontainers.image.title=mx-bluesky
org.opencontainers.image.description=Hyperion service for MX Unattended Data Collection
annotations: |
org.opencontainers.image.title=mx-bluesky
org.opencontainers.image.description=Hyperion service for MX Unattended Data Collection
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Push cached Hyperion image to container registry
if: inputs.publish && github.ref_type == 'tag'
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
# This does not build the image again, it will find the image in the
# Docker cache and publish it
with:
context: .
file: Dockerfile.hyperion
push: true
tags: ${{ steps.meta-hyperion.outputs.tags }}
labels: ${{ steps.meta-hyperion.outputs.labels }}
# Set the annotations to make the description appear in the GH repo page
annotations: ${{ steps.meta-hyperion.outputs.annotations }}
- name: Check disk space before
run: df -h && docker buildx du
- name: Prune local image cache before next build
run: docker buildx prune -f
- name: Check disk space after
run: df -h && docker buildx du
###############################
# BlueAPI Container Image Build
###############################
- name: Build and export Dockerfile.blueapi to local cache
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: Dockerfile.blueapi
load: true
- name: Create tags for publishing BlueAPI image
id: meta-blueapi
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}-blueapi
labels: |
org.opencontainers.image.title=mx-bluesky-blueapi
org.opencontainers.image.description=BlueAPI plans, stubs and utilities for MX beamlines
annotations: |
org.opencontainers.image.title=mx-bluesky-blueapi
org.opencontainers.image.description=BlueAPI plans, stubs and utilities for MX beamlines
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Push cached BlueAPI image to container registry
if: github.ref_type == 'tag'
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: Dockerfile.blueapi
push: true
tags: ${{ steps.meta-blueapi.outputs.tags }}
labels: ${{ steps.meta-blueapi.outputs.labels }}
# Set the annotations to make the description appear in the GH repo page
annotations: ${{ steps.meta-blueapi.outputs.annotations }}