Skip to content

Commit

Permalink
add arm image
Browse files Browse the repository at this point in the history
Signed-off-by: shaoyue.chen <[email protected]>
  • Loading branch information
haorenfsa committed Jan 19, 2024
1 parent 66d151a commit d8063a6
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 29 deletions.
101 changes: 79 additions & 22 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,99 @@
name: Build and Push on Tag

# This workflow is triggered on new tag pushed to the repository.
# ref doc: https://docs.docker.com/build/ci/github-actions/multi-platform/
on:
push:
tags:
- '*'
- "*"
env:
REGISTRY_IMAGE: milvusdb/etcd

jobs:
publish-builder:
name: Publish Builder
build:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu18.04]
env:
OS_NAME: ${{ matrix.os }}
REGISTRY_NAME: milvusdb/etcd
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get version from system time after release step
id: extracter
run: |
echo "::set-output name=git_tag::$(echo "${{ github.ref }}" | awk -F '/' '{print $3}')"
- name: Build Docker Image
shell: bash
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PWD }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: 3.5/debian-11
build-args: |
TARGETARCH=${{ matrix.platform }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PWD }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
IMAGE_TAG=${{ steps.extracter.outputs.git_tag }}
echo "Start Building ${REGISTRY_NAME}:${IMAGE_TAG}"
docker build -t ${REGISTRY_NAME}:${IMAGE_TAG} 3.5/debian-11
docker tag ${REGISTRY_NAME}:${IMAGE_TAG} ${REGISTRY_NAME}:latest
- name: Push Docker Image
shell: bash
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
IMAGE_TAG=${{ steps.extracter.outputs.git_tag }}
docker login -u ${{ secrets.DOCKER_USERNAME }} \
-p ${{ secrets.DOCKER_PWD }}
docker push ${REGISTRY_NAME}:${IMAGE_TAG}
docker push ${REGISTRY_NAME}:latest
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
22 changes: 15 additions & 7 deletions 3.5/debian-11/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM docker.io/bitnami/minideb:bullseye

ARG TARGETARCH
ARG TARGETARCH="linux/amd64"

LABEL maintainer="Team DevOps of Zilliz <[email protected]" \
org.opencontainers.image.authors="https://bitnami.com/contact" \
org.opencontainers.image.description="Application packaged by Bitnami, polished by zlliztech" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.ref.name="3.5.5-2-r3" \
org.opencontainers.image.ref.name="3.5.5-r4" \
org.opencontainers.image.source="https://github.com/milvus-io/bitnami-docker-etcd" \
org.opencontainers.image.title="etcd" \
org.opencontainers.image.vendor="VMware, Inc." \
org.opencontainers.image.version="3.5.5-2-r3"
org.opencontainers.image.version="3.5.5-r4"

ENV HOME="/" \
OS_ARCH="${TARGETARCH:-amd64}" \
OS_ARCH_RAW="${TARGETARCH}" \
OS_FLAVOUR="debian-11" \
OS_NAME="linux"

Expand All @@ -22,10 +22,18 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install required system packages and dependencies
RUN install_packages ca-certificates curl procps
RUN mkdir -p /tmp/bitnami/pkg/cache/ && cd /tmp/bitnami/pkg/cache/ && \
OS_ARCH=`echo ${OS_ARCH_RAW}| sed 's|/|-|'` && \
curl -SsLf https://github.com/etcd-io/etcd/releases/download/v3.5.5/etcd-v3.5.5-${OS_ARCH}.tar.gz -O && \
tar -zxf "etcd-v3.5.5-${OS_ARCH}.tar.gz" && \
mkdir -p /opt/bitnami/etcd/bin && \
mv ./etcd-v3.5.5-${OS_ARCH}/etcd /opt/bitnami/etcd/bin/etcd && \
mv ./etcd-v3.5.5-${OS_ARCH}/etcdctl /opt/bitnami/etcd/bin/etcdctl && \
mv ./etcd-v3.5.5-${OS_ARCH}/etcdutl /opt/bitnami/etcd/bin/etcdutl && \
rm -rf "etcd-v3.5.5-${OS_ARCH}.tar.gz"
RUN cd /tmp/bitnami/pkg/cache/ && \
OS_ARCH=`echo ${OS_ARCH_RAW}| sed 's|/|-|'` && \
COMPONENTS=( \
"yq-4.30.8-1-linux-${OS_ARCH}-debian-11" \
"gosu-1.16.0-1-linux-${OS_ARCH}-debian-11" \
"etcd-3.5.5-2-linux-${OS_ARCH}-debian-11" \
"yq-4.40.5-0-${OS_ARCH}-debian-11" \
) && \
for COMPONENT in "${COMPONENTS[@]}"; do \
if [ ! -f "${COMPONENT}.tar.gz" ]; then \
Expand Down

0 comments on commit d8063a6

Please sign in to comment.