-
Notifications
You must be signed in to change notification settings - Fork 49
98 lines (85 loc) · 3.14 KB
/
docker-release.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
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
name: Build release Docker images
on:
workflow_call:
inputs:
# comes from cargo-dist workflow call
plan:
required: true
type: string
env:
PLAN: ${{ inputs.plan }}
jobs:
build-docker-image:
name: Build server Docker image
uses: ./.github/workflows/docker.yml
secrets: inherit
with:
pushToDockerHub: true
parca: true
buildIndividually: true
docker-cli:
name: Push CLI Docker image
runs-on: warp-ubuntu-latest-x64-4x
env:
REPOSITORY_OWNER: ${{ github.repository_owner }}
GHCR_REGISTRY: "ghcr.io"
GHCR_REGISTRY_USERNAME: ${{ github.actor }}
GHCR_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: "restate-cli"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into GitHub container registry
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ env.GHCR_REGISTRY_USERNAME }}
password: ${{ env.GHCR_REGISTRY_TOKEN }}
- name: Log into DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Download linux binaries
uses: actions/download-artifact@v4
with:
pattern: artifacts-*-unknown-linux-musl
merge-multiple: true
- name: Write release version
id: version
run: |
VERSION="$(echo "$PLAN" | jq -r '[.releases[] | select(.app_name == "restate-cli")][0].app_version')"
echo Version: ${VERSION}
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}
${{ format('docker.io/{0}/{1}', env.REPOSITORY_OWNER, env.IMAGE_NAME) }}
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.VERSION }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.VERSION }}
- name: Create Dockerfile
run: |
cat > Dockerfile << 'EOF'
FROM --platform=${BUILDPLATFORM} alpine as builder
ADD restate-cli-aarch64-unknown-linux-musl.tar.xz /restate-cli-arm64
ADD restatectl-aarch64-unknown-linux-musl.tar.xz /restatectl-arm64
ADD restate-cli-x86_64-unknown-linux-musl.tar.xz /restate-cli-amd64
ADD restatectl-x86_64-unknown-linux-musl.tar.xz /restatectl-amd64
FROM alpine
ARG TARGETARCH
COPY --from=builder /restatectl-${TARGETARCH}/*/restatectl /
COPY --from=builder /restate-cli-${TARGETARCH}/*/* /
ENTRYPOINT [ "/restate" ]
EOF
- name: Build and push multiplatform image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64,linux/amd64