Verified Commit a7b9b723 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Merge branch 'arm64'

Merge changes necessary to build ARM64 Docker images

https://github.com/yandex-cloud/k8s-csi-s3/pull/51
parents d04af5f8 0f5dca8e
Loading
Loading
Loading
Loading
+35 −3
Original line number Diff line number Diff line
@@ -5,15 +5,47 @@ on:
    tags:
    - "v*"

env:
  REGISTRY_NAME: cr.yandex/crp9ftr22d26age3hulg
  REGISTRY_NAME2: cr.il.nebius.cloud/crll7us9n6i5j3v4n92m
  IMAGE_NAME: csi-s3
  IMAGE_NAME2: yandex-cloud/csi-s3/csi-s3-driver

jobs:

  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set IMAGE_TAG env
      # GITHUB_REF value: refs/heads/v*
      run: echo "VERSION=$(echo ${GITHUB_REF:11})" >> $GITHUB_ENV

    - uses: actions/checkout@v3

    - name: Set up Docker Buildx
      id: buildx
      uses: docker/setup-buildx-action@v2
    - name: Show available platforms
      run: echo ${{ steps.buildx.outputs.platforms }}

    - name: Push Docker
      run: (echo '${{ secrets.REGISTRY_KEY }}' | docker login --username json_key --password-stdin cr.yandex) && make push
    - name: Login to Registry
      uses: docker/login-action@v2
      with:
        registry: cr.yandex
        username: json_key
        password: ${{ secrets.REGISTRY_KEY }}

    - name: Build and push
      uses: docker/build-push-action@v4
      with:
        context: .
        push: true
        platforms: linux/amd64,linux/arm64
        tags: |
          ${{ env.REGISTRY_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
          ${{ env.REGISTRY_NAME }}/${{ env.IMAGE_NAME }}:latest
          ${{ env.REGISTRY_NAME }}/${{ env.IMAGE_NAME2 }}:${{ env.VERSION }}
          ${{ env.REGISTRY_NAME }}/${{ env.IMAGE_NAME2 }}:latest

    - uses: "marvinpinto/action-automatic-releases@latest"
      with:
+17 −3
Original line number Diff line number Diff line
FROM golang:1.19-alpine as gobuild
# Golang can cross-compile
FROM --platform=$BUILDPLATFORM golang:1.19-alpine as gobuild

WORKDIR /build
ADD go.mod go.sum /build/
RUN go mod download -x
ADD cmd /build/cmd
ADD pkg /build/pkg
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ./s3driver ./cmd/s3driver

ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -ldflags '-extldflags "-static"' -o ./s3driver ./cmd/s3driver

FROM --platform=$BUILDPLATFORM alpine:3.17 AS downloader

WORKDIR /work

RUN apk add --no-cache curl

ARG TARGETOS
ARG TARGETARCH
RUN curl https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-$TARGETOS-$TARGETARCH -LfSso /work/geesefs

FROM alpine:3.17
LABEL maintainers="Vitaliy Filippov <vitalif@yourcmc.ru>"
@@ -14,7 +28,7 @@ LABEL description="csi-s3 slim image"
RUN apk add --no-cache fuse mailcap rclone
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community s3fs-fuse

ADD https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-amd64 /usr/bin/geesefs
COPY --from=downloader /work/geesefs /usr/bin/geesefs
RUN chmod 755 /usr/bin/geesefs

COPY --from=gobuild /build/s3driver /s3driver