Skip to content

Commit 6d61952

Browse files
committed
feat: add docker build image in Github Action
Signed-off-by: Wen Zhou <[email protected]>
1 parent 22fc677 commit 6d61952

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

Diff for: .github/workflows/release.yml

+36-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ jobs:
2727
name: Release
2828
runs-on: ubuntu-latest
2929
timeout-minutes: 30
30+
outputs:
31+
release-version: ${{ steps.package_release.outputs.version }}
3032
steps:
31-
- uses: actions/checkout@v2.4.0
33+
- uses: actions/checkout@v3.0.2
3234
- uses: actions/[email protected]
3335
with:
3436
dotnet-version: '6.0'
@@ -88,3 +90,36 @@ jobs:
8890
git add docs
8991
git commit -m "Update GitHub pages" || true
9092
git push https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git HEAD:gh-pages
93+
94+
docker:
95+
name: docker
96+
runs-on: ubuntu-latest
97+
needs:
98+
- release
99+
env:
100+
IMAGE_NAME: ${{ github.repository }}
101+
IMAGE_VERSION: ${{ needs.release.outputs.release-version }}
102+
103+
timeout-minutes: 5
104+
steps:
105+
- uses: actions/[email protected]
106+
107+
- name: Set up QEMU
108+
uses: docker/setup-qemu-action@v2
109+
110+
- name: Login to DockerHub
111+
uses: docker/login-action@v2
112+
with:
113+
username: ${{ secrets.DOCKERHUB_USERNAME }}
114+
password: ${{ secrets.DOCKERHUB_TOKEN }}
115+
116+
- name: Build image and push
117+
uses: docker/build-push-action@v3
118+
with:
119+
platforms: linux/amd64,linux/arm64
120+
push: true
121+
build-args:
122+
VERSION=${{ env.IMAGE_VERSION }}
123+
tags: |
124+
cyclonedx/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
125+
cyclonedx/${{ env.IMAGE_NAME }}:latest

Diff for: Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM python:3-alpine
3+
ARG VERSION
4+
5+
WORKDIR /wwwroot
6+
ADD "https://github.com/CycloneDX/cyclonedx-web-tool/releases/download/v${VERSION}/CycloneDX.WebTool.${VERSION}.tar.gz" /tmp
7+
RUN tar xvfz /tmp/CycloneDX.WebTool.${VERSION}.tar.gz
8+
9+
ENTRYPOINT [ "python3", "-m", "http.server"]
10+
CMD [ "8000" ]

0 commit comments

Comments
 (0)