1+ name : build-server
2+ description : Sets up the build context and builds a docker image
3+ inputs :
4+ server-profile :
5+ required : true
6+ description : The profile of the server to build (discovery, registry, repository)
7+ load :
8+ required : false
9+ description : Set to "true" to use image in further steps (only works for single architecture builds)
10+ default : " false"
11+ platform :
12+ required : false
13+ description : The target platforms to build the image for
14+ default : " linux/amd64"
15+ publish :
16+ required : false
17+ description : Set to "true" to publish image to Docker Hub (requires login)
18+ default : " false"
19+
20+ outputs :
21+ image-digest :
22+ description : The image name + digest of the built image
23+ value : ${{ steps.build.outputs.imageid }}@${{ steps.build.outputs.digest }}
24+
25+ runs :
26+ using : composite
27+ steps :
28+ - name : Checkout Repository
29+ uses : actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
30+
31+ - name : Setup QEMU
32+ uses : docker/setup-qemu-action@v4
33+
34+ - name : Set up Docker Buildx
35+ uses : docker/setup-buildx-action@v4
36+
37+ - name : Generate Image Title
38+ id : capitalize
39+ shell : bash
40+ run : |
41+ profile="${{ inputs.server-profile }}"
42+ echo "profile-title=${profile^}" >> "$GITHUB_OUTPUT"
43+
44+ - name : Extract Docker image metadata
45+ id : meta
46+ uses : docker/metadata-action@v5
47+ with :
48+ images : eclipsebasyx/basyx-python-${{ inputs.server-profile }}
49+ # This fetches the latest git tag and adds an additional "latest" to it, so e.g. `2.1.0,latest`
50+ tags : |
51+ type=semver,pattern={{version}}
52+ type=raw,value=latest,enable=${{ inputs.publish == 'true' && true || false }}
53+ type=sha,prefix=pr-,enable=${{ inputs.load == 'true' && true || false }}
54+ labels : |
55+ org.opencontainers.image.title=BaSyx Python ${{ steps.capitalize.outputs.profile-title }} Service
56+ org.opencontainers.image.description=Eclipse BaSyx Python SDK - ${{ steps.capitalize.outputs.profile-title }} HTTP Server
57+ org.opencontainers.image.source=https://github.com/eclipse-basyx/basyx-python-sdk/tree/main/server
58+ org.opencontainers.image.licenses=MIT
59+
60+ - name : Build Docker Image
61+ id : build
62+ uses : docker/build-push-action@v6
63+ with :
64+ context : .
65+ file : ./server/docker/${{ inputs.server-profile }}/Dockerfile
66+ tags : ${{ steps.meta.outputs.tags }}
67+ labels : ${{ steps.meta.outputs.labels }}
68+ platforms : ${{ inputs.platform }}
69+ # push: ${{ inputs.publish == 'true' && true || false }}
70+ load : ${{ inputs.load == 'true' && true || false }}
0 commit comments