Skip to content

Commit

Permalink
Merge pull request #316 from eclipse-tractusx/cicd/dockerhub
Browse files Browse the repository at this point in the history
(feat): Push Images to Dockerhub
  • Loading branch information
nicoprow authored Jun 30, 2023
2 parents 4bbada1 + 0bac3a6 commit 51bbfbe
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 19 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/build-docker-all.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
################################################################################
# Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
################################################################################

name: Build All - Docker images (SemVer)
on:
push:
Expand All @@ -8,6 +27,7 @@ on:
- bpdm-gate/**
- bpdm-common/**
- bpdm-gate-api/**
- bpdm-bridge-dummy/**
- .github/workflows/**
tags:
- 'v*.*.*'
Expand All @@ -22,21 +42,24 @@ on:
jobs:
build-docker-pool:
uses: ./.github/workflows/build-docker.yaml
secrets: inherit
with:
imageName: pool
dockerfilePath: ./bpdm-pool/Dockerfile
imageName: bpdm-pool
dockerfilePath: ./bpdm-pool
push: ${{ github.event_name != 'pull_request' }}

build-docker-gate:
uses: ./.github/workflows/build-docker.yaml
secrets: inherit
with:
imageName: gate
dockerfilePath: ./bpdm-gate/Dockerfile
imageName: bpdm-gate
dockerfilePath: ./bpdm-gate
push: ${{ github.event_name != 'pull_request' }}

build-docker-bridge-dummy:
uses: ./.github/workflows/build-docker.yaml
secrets: inherit
with:
imageName: bridge-dummy
dockerfilePath: ./bpdm-bridge-dummy/Dockerfile
imageName: bpdm-bridge-dummy
dockerfilePath: ./bpdm-bridge-dummy
push: ${{ github.event_name != 'pull_request' }}
61 changes: 48 additions & 13 deletions .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
################################################################################
# Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
################################################################################

name: Build - Docker image (SemVer)

on:
Expand All @@ -18,15 +37,15 @@ on:


env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}/${{ inputs.imageName }}
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: ${{ inputs.imageName }}

jobs:
build-docker:
docker:
runs-on: ubuntu-latest
permissions:
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,27 +56,43 @@ jobs:
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
# Automatically prepare image tags; See action docs for more examples.
# semver patter will generate tags like these for example :1 :1.2 :1.2.3
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
- name: DockerHub login
if: inputs.push
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Use existing DockerHub credentials present as secrets
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
# Build image for verification purposes on every trigger event. Only push if event is not a PR
push: ${{ inputs.push }}
file: ${{ inputs.dockerfilePath }}
file: ${{ inputs.dockerfilePath }}/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}

# https://github.com/peter-evans/dockerhub-description
# Important step to push image description to DockerHub
- name: Update Docker Hub description
if: inputs.push
uses: peter-evans/dockerhub-description@v3
with:
# readme-filepath defaults to toplevel README.md, Only necessary if you have a dedicated file with your 'Notice for docker images'
# readme-filepath: path/to/dedicated/notice-for-docker-image.md
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ${{ inputs.dockerfilePath }}/DOCKER_NOTICE.md
28 changes: 28 additions & 0 deletions bpdm-bridge-dummy/DOCKER_NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Notice for Docker image

DockerHub: [https://hub.docker.com/r/tractusx/bpdm](https://hub.docker.com/r/tractusx/bpdm)

Eclipse Tractus-X product(s) installed within the image:

**BPDM Bridge**

Eclipse Tractus-X product(s) installed within the image:

- GitHub: https://github.com/eclipse-tractusx/bpdm
- Project home: https://projects.eclipse.org/projects/automotive.tractusx
- Bridge Dockerfile: https://github.com/eclipse-tractusx/bpdm/blob/main/bpdm-brige-dumy/Dockerfile
- Project license: [Apache License, Version 2.0](https://github.com/eclipse-tractusx/bpdm/blob/main/LICENSE)


**Used base image**

- [eclipse-temurin:17-jre-alpine](https://github.com/adoptium/containers)
- Official Eclipse Temurin DockerHub page: https://hub.docker.com/_/eclipse-temurin
- Eclipse Temurin Project: https://projects.eclipse.org/projects/adoptium.temurin
- Additional information about the Eclipse Temurin images: https://github.com/docker-library/repo-info/tree/master/repos/eclipse-temurin


As with all Docker images, these likely also contain other software which may be under other licenses
(such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
28 changes: 28 additions & 0 deletions bpdm-gate/DOCKER_NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Notice for Docker image

DockerHub: [https://hub.docker.com/r/tractusx/bpdm](https://hub.docker.com/r/tractusx/bpdm)

Eclipse Tractus-X product(s) installed within the image:

**BPDM Gate**

Eclipse Tractus-X product(s) installed within the image:

- GitHub: https://github.com/eclipse-tractusx/bpdm
- Project home: https://projects.eclipse.org/projects/automotive.tractusx
- Gate Dockerfile: https://github.com/eclipse-tractusx/bpdm/blob/main/bpdm-gate/Dockerfile
- Project license: [Apache License, Version 2.0](https://github.com/eclipse-tractusx/bpdm/blob/main/LICENSE)


**Used base image**

- [eclipse-temurin:17-jre-alpine](https://github.com/adoptium/containers)
- Official Eclipse Temurin DockerHub page: https://hub.docker.com/_/eclipse-temurin
- Eclipse Temurin Project: https://projects.eclipse.org/projects/adoptium.temurin
- Additional information about the Eclipse Temurin images: https://github.com/docker-library/repo-info/tree/master/repos/eclipse-temurin


As with all Docker images, these likely also contain other software which may be under other licenses
(such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
28 changes: 28 additions & 0 deletions bpdm-pool/DOCKER_NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Notice for Docker image

DockerHub: [https://hub.docker.com/r/tractusx/bpdm](https://hub.docker.com/r/tractusx/bpdm)

Eclipse Tractus-X product(s) installed within the image:

**BPDM Pool**

Eclipse Tractus-X product(s) installed within the image:

- GitHub: https://github.com/eclipse-tractusx/bpdm
- Project home: https://projects.eclipse.org/projects/automotive.tractusx
- Pool Dockerfile: https://github.com/eclipse-tractusx/bpdm/blob/main/bpdm-pool/Dockerfile
- Project license: [Apache License, Version 2.0](https://github.com/eclipse-tractusx/bpdm/blob/main/LICENSE)


**Used base image**

- [eclipse-temurin:17-jre-alpine](https://github.com/adoptium/containers)
- Official Eclipse Temurin DockerHub page: https://hub.docker.com/_/eclipse-temurin
- Eclipse Temurin Project: https://projects.eclipse.org/projects/adoptium.temurin
- Additional information about the Eclipse Temurin images: https://github.com/docker-library/repo-info/tree/master/repos/eclipse-temurin


As with all Docker images, these likely also contain other software which may be under other licenses
(such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

0 comments on commit 51bbfbe

Please sign in to comment.