Skip to content

Commit 8b75b39

Browse files
committed
add image build
1 parent 9e625fa commit 8b75b39

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/build.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
release:
9+
types:
10+
- published
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Prepare
17+
id: prep
18+
run: |
19+
DOCKER_IMAGE=ghcr.io/gdatasoftwareag/fuse-device-plugin
20+
VERSION=edge
21+
if [[ $GITHUB_REF == refs/tags/* ]]; then
22+
VERSION=${GITHUB_REF#refs/tags/}
23+
elif [[ $GITHUB_REF == refs/heads/* ]]; then
24+
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
25+
elif [[ $GITHUB_REF == refs/pull/* ]]; then
26+
VERSION=pr-${{ github.event.number }}
27+
fi
28+
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${VERSION}-${GITHUB_SHA::8}"
29+
echo ::set-output name=version::${VERSION}
30+
echo ::set-output name=tags::${TAGS}
31+
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
32+
- name: Login to Github Registry
33+
uses: docker/login-action@v2
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Push to GitHub Packages
39+
uses: docker/build-push-action@v4
40+
with:
41+
push: ${{ github.event_name == 'release' }}
42+
tags: ${{ steps.prep.outputs.tags }}
43+
labels: |
44+
org.opencontainers.image.revision=${{ github.sha }}
45+
org.opencontainers.image.created=${{ steps.prep.outputs.created }}

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ COPY --from=builder /code/fuse-device-plugin/fuse-device-plugin /usr/bin/fuse-de
1010

1111
# replace with your desire device count
1212
CMD ["fuse-device-plugin", "--mounts_allowed", "5000"]
13+
14+
LABEL org.opencontainers.image.title="Fuse device plugin Docker Image" \
15+
org.opencontainers.image.description="fuse-device-plugin" \
16+
org.opencontainers.image.url="https://github.com/GDATASoftwareAG/fuse-device-plugin" \
17+
org.opencontainers.image.source="https://github.com/GDATASoftwareAG/fuse-device-plugin" \
18+
org.opencontainers.image.license="Apache 2.0"

0 commit comments

Comments
 (0)