-
Notifications
You must be signed in to change notification settings - Fork 7
62 lines (54 loc) · 1.98 KB
/
upload-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
62
name: Push Images
on:
push:
branches: [ main ]
permissions: read-all
jobs:
build:
name: Push Updated Images
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- name: Login to Quay.io
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf #v45.0.4
with:
dir_names: 'true'
- name: Push Changed Images
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
BASE_DIR=$(pwd)
for dir in ${ALL_CHANGED_FILES}; do
echo "Change detected in $dir ..."
prevdir=$(dirname $dir)
if [ $prevdir == "model-servers/vllm" ]; then
echo "Skipping uploading of vllm model server changes! Please perform a manual upload ..."
continue
fi
cd $dir
if [ ! -f config.env ]; then
echo "No config.env file present in changed directory, skipping ..."
cd $BASE_DIR
continue
fi
source config.env
echo "Running 'docker build' in $dir ..."
if [ -f "Containerfile" ]; then
docker build -t "${IMAGE_NAME}":temp -f Containerfile .
else
docker build -t "${IMAGE_NAME}":temp -f Dockerfile .
fi
docker tag "${IMAGE_NAME}":temp "${IMAGE_NAME}":"${IMAGE_TAG}" && docker push "${IMAGE_NAME}":"${IMAGE_TAG}"
docker tag "${IMAGE_NAME}":temp "${IMAGE_NAME}":"${GITHUB_SHA}" && docker push "${IMAGE_NAME}":"${GITHUB_SHA}"
cd $BASE_DIR
done