forked from sandialabs/OpenCSP
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (53 loc) · 1.52 KB
/
docker.yml
File metadata and controls
65 lines (53 loc) · 1.52 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
name: github-DOCKER
on:
push:
branches:
- main
- develop
permissions:
contents: none
env:
IMAGE_REGISTRY: "ghcr.io/sandialabs/opencsp"
jobs:
container_build_matrix:
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile: [Dockerfile, Dockerfile_x11]
include:
- dockerfile: Dockerfile
ARCH: amd64
TAG: ubi8
- dockerfile: Dockerfile_x11
ARCH: amd64
TAG: ubi8-x11
- dockerfile: Dockerfile_x11
ARCH: arm64
TAG: ubi8-x11
steps:
- uses: actions/checkout@v4
- name: Set vars
run: |
export REV=$(echo "${GITHUB_SHA}" | cut -c1-7)
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
export REV=latest
fi
echo "FULL_TAG=$IMAGE_REGISTRY:${{matrix.TAG }}-${{matrix.ARCH}}-$REV" >> $GITHUB_ENV
- name: Build image
run: |
cp requirements.txt ./docker
echo "FULL_TAG=$FULL_TAG"
docker build ./docker \
--build-arg="TARGET_ARCH=${{matrix.ARCH}}" \
--file "${{matrix.dockerfile}}" \
--tag "$FULL_TAG" \
--label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push image
run: |
echo "FULL_TAG=$FULL_TAG"
docker push "$FULL_TAG"
permissions:
packages: write
contents: read