Skip to content

Commit

Permalink
Migrate to harbor (tikv#234)
Browse files Browse the repository at this point in the history
* Migrate to harbor

Signed-off-by: Xiaoguang Sun <[email protected]>
  • Loading branch information
sunxiaoguang authored Nov 22, 2023
1 parent 01c786b commit 2d3af36
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 13 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,44 @@ jobs:
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-arm64:
name: Build ARM64 Image
runs-on: arm64
env:
GITHUB_TOKEN: ${{ secrets.GIT_ACTION_BOT }}
steps:
- name: Build and Push Images
uses: docker/build-push-action@v2
with:
platforms: "linux/arm64"
push: true
build-args: |
GITHUB_TOKEN=${{ secrets.GIT_ACTION_BOT }}
tags: hub.pingcap.net/sunxiaoguang/serverless/pd:${{ github.sha }}-arm64
build-amd64:
name: Build AMD64 Image
runs-on: amd64
env:
GITHUB_TOKEN: ${{ secrets.GIT_ACTION_BOT }}
steps:
- name: Build and Push Images
uses: docker/build-push-action@v2
with:
platforms: "linux/amd64"
push: true
build-args: |
GITHUB_TOKEN=${{ secrets.GIT_ACTION_BOT }}
tags: hub.pingcap.net/sunxiaoguang/serverless/pd:${{ github.sha }}-amd64
multi-arch:
name: Create Multi-Architecture Image
runs-on: amd64
needs: ["build-arm64", "build-amd64"]
steps:
- name: create-manifest
run: |
docker manifest create hub.pingcap.net/sunxiaoguang/serverless/pd:${{ github.sha }} \
--amend hub.pingcap.net/sunxiaoguang/serverless/pd:${{ github.sha }}-amd64 \
--amend hub.pingcap.net/sunxiaoguang/serverless/pd:${{ github.sha }}-arm64
- name: push-manifest
run: |
docker manifest push hub.pingcap.net/sunxiaoguang/serverless/pd:${{ github.sha }}
24 changes: 11 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
FROM golang:1.20-bullseye as builder
FROM golang:1.21-bullseye as builder

RUN apt update && apt install -y make git curl gcc g++ unzip

# Setup ssh key for private deps
ARG ssh_key
RUN if [ -n "$ssh_key" ]; then \
mkdir -p ~/.ssh && \
echo "$ssh_key" > ~/.ssh/key && \
chmod 600 ~/.ssh/key && \
echo "Host github.com" >> ~/.ssh/config && \
echo "\tUser git" >> ~/.ssh/config && \
echo "\tPort 443" >> ~/.ssh/config && \
echo "\tHostName ssh.github.com" >> ~/.ssh/config && \
echo "\tIdentityFile ~/.ssh/key" >> ~/.ssh/config && \
ssh-keyscan -p 443 ssh.github.com>> ~/.ssh/known_hosts && \
git config --global url."ssh://[email protected]/".insteadOf "https://github.com/"; \
ARG GITHUB_TOKEN
RUN if [ -n "$GITHUB_TOKEN" ]; then \
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"; \
fi

RUN mkdir -p /go/src/github.com/tikv/pd
Expand All @@ -28,6 +19,13 @@ RUN GO111MODULE=on go mod download

COPY . .

# Set CGO_ENABLED=0 for cross compiling.
ENV CGO_ENABLED=0
# Skip swagger generation.
ENV SWAGGER=0
# Skip building dashboard.
ENV DASHBOARD=0

RUN make

FROM debian:bullseye-20220711-slim
Expand Down

0 comments on commit 2d3af36

Please sign in to comment.