Merge pull request #1271 from Bastian-Krause/bst/update-gh-actions #386
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker build | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- '*' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: | | |
sudo apt install -yq python3-pip | |
python3 -m pip install setuptools_scm | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build docker image | |
run: | | |
./dockerfiles/build.sh | |
docker-compose -f dockerfiles/staging/docker-compose.yml up --exit-code-from client client | |
docker-compose -f dockerfiles/staging/docker-compose.yml down | |
docker images | |
- name: Tag latest images | |
run: | | |
docker tag labgrid-client ${{ secrets.DOCKERHUB_PREFIX }}client | |
docker tag labgrid-exporter ${{ secrets.DOCKERHUB_PREFIX }}exporter | |
docker tag labgrid-coordinator ${{ secrets.DOCKERHUB_PREFIX }}coordinator | |
- name: Tag release image | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
docker tag labgrid-client ${{ secrets.DOCKERHUB_PREFIX }}client:${GITHUB_REF_NAME} | |
docker tag labgrid-exporter ${{ secrets.DOCKERHUB_PREFIX }}exporter:${GITHUB_REF_NAME} | |
docker tag labgrid-coordinator ${{ secrets.DOCKERHUB_PREFIX }}coordinator:${GITHUB_REF_NAME} | |
- name: Push to dockerhub | |
run: | | |
docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}client | |
docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}exporter | |
docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}coordinator | |
- name: Show images again | |
run: docker images |