forked from timescale/tsbs
-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (58 loc) · 2.18 KB
/
docker.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
67
name: Build tsbs docker image manually
on:
workflow_dispatch:
inputs:
commitsha:
description: 'Commit sha to build image'
required: true
type: string
jobs:
docker:
name: Build and push image
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.commitsha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install skopeo
run: |
sudo apt update && sudo apt install -y skopeo
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Configure build image tag
shell: bash
run: |
commitShortSHA=`echo ${{ inputs.commitsha }} | cut -c1-8`
buildTime=`date +%Y%m%d%H%M%S`
IMAGE_TAG="$commitShortSHA-$buildTime"
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
docker.io/greptime/tsbs:latest
docker.io/greptime/tsbs:${{ env.IMAGE_TAG }}
- name: Sync images to ACR
shell: bash
env:
DST_REGISTRY_USERNAME: ${{ secrets.ALICLOUD_USERNAME }}
DST_REGISTRY_PASSWORD: ${{ secrets.ALICLOUD_PASSWORD }}
run: |
docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/greptime/tsbs:${{ env.IMAGE_TAG }} \
--dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \
docker://greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/tsbs:latest && \
docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/greptime/tsbs:${{ env.IMAGE_TAG }} \
--dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \
docker://greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/tsbs:${{ env.IMAGE_TAG }}