Skip to content

Commit

Permalink
build docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Hou Junjie committed Jan 5, 2021
1 parent dfecf26 commit 5e6055d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: csi-huawei image
on:
push:
branches:
- master
tags:
- v*.*.*

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2

- name: login to docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- id: image_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: $GITHUB_ACTOR/csi-huawei # list of Docker images to use as base name for tags
tag-sha: true # add git short SHA as Docker tag

- name: build driver
id: docker_build_s3_driver
uses: docker/build-push-action@v2
with:
context: ./
file: Dockerfile
push: true
tags: ${{ steps.image_meta.outputs.tags }}
labels: ${{ steps.image_meta.outputs.labels }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:alpine AS builder

WORKDIR /src
COPY . /src/
RUN go build -o bin/huawei-csi ./src/csi

FROM alpine
COPY --from=builder /src/bin/huawei-csi /huawei-csi
ENTRYPOINT [ "/huawei-csi" ]
18 changes: 0 additions & 18 deletions Makefile-CSI

This file was deleted.

0 comments on commit 5e6055d

Please sign in to comment.