Skip to content
Merged
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
15 changes: 13 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ jobs:
with:
driver-opts: image=moby/buildkit:master

- name: Extract tag name
id: tag
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG_NAME="${GITHUB_REF#refs/tags/}"
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "Extracted tag: ${TAG_NAME}"
else
echo "tag_name=latest" >> $GITHUB_OUTPUT
fi

- name: Build and optionally push
uses: docker/build-push-action@v6.18.0
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
tags: projecthami/mock-device-plugin:latest
push: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') }}
tags: projecthami/mock-device-plugin:${{ steps.tag.outputs.tag_name }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM golang:1.21-bullseye AS GOBUILD
FROM golang:1.21-bullseye AS gobuild
ADD . /device-plugin
RUN cd /device-plugin && go build -o ./k8s-device-plugin cmd/k8s-device-plugin/main.go

FROM ubuntu:20.04
WORKDIR /root/
COPY --from=GOBUILD /device-plugin/k8s-device-plugin .
COPY --from=gobuild /device-plugin/k8s-device-plugin .
CMD ["./k8s-device-plugin", "-logtostderr=true", "-stderrthreshold=INFO", "-v=5", "--device-config-file=/device-config.yaml"]