Skip to content

Update Dockerfile

Update Dockerfile #16

name: build containers metrics-operator
on:
pull_request: []
push:
branches:
- main
jobs:
build-containers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: [["sysstat", "ghcr.io/converged-computing/metric-sysstat:latest"],
["osu-benchmark", "ghcr.io/converged-computing/metric-osu-benchmark:latest"]]
steps:
- name: Clone the code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.20
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Layers (if exist)
env:
container: ${{ matrix.test[1] }}
run: docker pull ${container} || echo "${container} not pushed yet"
- name: Build Container
env:
context: ${{ matrix.test[0] }}
container: ${{ matrix.test[1] }}
run: |
cd ${context}
docker build -t ${container} .
- name: Deploy Container
if: (github.event_name != 'pull_request')
env:
container: ${{ matrix.test[1] }}
run: docker push ${container}