Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build linux/arm64 images #51

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 17 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
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 <[email protected]>"
Expand All @@ -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
Expand Down