-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (66 loc) · 2.44 KB
/
docker-cuda-base.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
name: cuda_base_image
on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
jobs:
docker-ci:
runs-on: ubuntu-latest
name: "docker cuda base"
env:
DOCKERPATH: docker/test-cuda-base
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# - uses: jitterbit/get-changed-files@v1
- uses: Ana06/get-changed-files@v2.2.0
id: files
# continue-on-error: true
- name: DockerPATH configuration
run: echo "DOCKERPATH=$DOCKERPATH"
- name: DockerPATH - check if files in docker path changed
if: contains(steps.files.outputs.all,env.DOCKERPATH) || contains(steps.files.outputs.all,'docker-cuda-base.yaml')
run: |
echo "CI container needs rebuilding..."
echo "CI_NEEDS_REBUILD=true" >> $GITHUB_ENV
- name: Docker Image - Set up QEMU
if: env.CI_NEEDS_REBUILD
uses: docker/setup-qemu-action@v2
- name: Docker Image - Setup Buildx
if: env.CI_NEEDS_REBUILD
uses: docker/setup-buildx-action@v2
- name: Docker Image - Dockerhub login
if: env.CI_NEEDS_REBUILD
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
if: env.CI_NEEDS_REBUILD
uses: docker/metadata-action@v4
with:
images: pecosut/tps_cuda_base
tags: type=sha
flavor: latest=true
- name: Build Container motd
if: env.CI_NEEDS_REBUILD
run: |
echo "#!/bin/bash" > ${{env.DOCKERPATH}}/motd.sh
echo "echo --------------------------" >> ${{env.DOCKERPATH}}/motd.sh
echo "echo TPS/CI CUDA base Container" >> ${{env.DOCKERPATH}}/motd.sh
echo "echo \"Revision: `echo ${GITHUB_SHA} | cut -c1-8`\"" >> ${{env.DOCKERPATH}}/motd.sh
echo "echo --------------------------" >> ${{env.DOCKERPATH}}/motd.sh
chmod 755 ${{env.DOCKERPATH}}/motd.sh
cat ${{env.DOCKERPATH}}/motd.sh
- name: Docker Image - Build and push
if: env.CI_NEEDS_REBUILD
uses: docker/build-push-action@v3
with:
push: true
context: ${{ env.DOCKERPATH }}
tags: ${{ steps.meta.outputs.tags }}