Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable GitHub Actions for automated docker builds #203

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/docker-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Docker Builds

on:
push:
branches:
- '**'
tags:
- '*.*.*'
pull_request:
branches:
- 'master'

jobs:
setup-docker-builds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get containers to build
id: get_containers
run: |
python3 -c '
import json
import pathlib
print(
"::set-output name=containers::%s"
% json.dumps([
str(path.parent.relative_to("containers"))
for path in pathlib.Path("containers").glob("**/Dockerfile")
]
))
'
outputs:
containers: ${{ steps.get_containers.outputs.containers }}

docker-builds:
needs: setup-docker-builds
runs-on: ubuntu-latest
strategy:
matrix:
containers: ${{ fromJSON(needs.setup-docker-builds.outputs.containers) }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
tags: |
type=pep440,pattern={{version}}
type=raw,value=latest
images: matterminers/${{ matrix.containers }}
- name: Login to DockerHub
if: github.repository == 'MatterMiners/tardis' && github.ref == 'refs/heads/master'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
id: docker_build
uses: docker/build-push-action@v2
with:
context: containers/${{ matrix.containers }}
push: ${{ github.repository == 'MatterMiners/tardis' && github.ref == 'refs/heads/master' }}
file: containers/${{ matrix.containers }}/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
build-args: |
SOURCE_BRANCH=${{ github.ref }}
SOURCE_REPO_URL=https://github.com/${{ github.repository }}
3 changes: 2 additions & 1 deletion containers/cobald-tardis-htcondor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ RUN yum -y update \
python3-devel \
&& yum clean all

RUN python3 -m pip install --no-cache-dir git+$SOURCE_REPO_URL@$SOURCE_BRANCH
RUN python3 -m pip install --no-cache-dir --upgrade pip \
&& python3 -m pip install --no-cache-dir git+$SOURCE_REPO_URL@$SOURCE_BRANCH

WORKDIR /srv

Expand Down
4 changes: 0 additions & 4 deletions containers/cobald-tardis-htcondor/hooks/build

This file was deleted.

4 changes: 0 additions & 4 deletions containers/cobald-tardis/hooks/build

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Created by changelog.py at 2021-08-10, command
.. Created by changelog.py at 2021-09-01, command
'/Users/giffler/.cache/pre-commit/repor6pnmwlm/py_env-python3.9/bin/changelog docs/source/changes compile --output=docs/source/changelog.rst'
based on the format of 'https://keepachangelog.com/'

Expand Down