This commit is contained in:
motoki317 2023-09-29 11:45:13 +02:00 committed by GitHub
commit 8b5b6b8454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 6 deletions
.github/workflows
Dockerfile

View file

@ -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
- name: Push Docker
run: (echo '${{ secrets.REGISTRY_KEY }}' | docker login --username json_key --password-stdin cr.yandex) && make push
- 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: 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:

View file

@ -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 <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