Merge pull request #509 from kool-dev/build-args-envs #54
Workflow file for this run
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 | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@master | |
- uses: olegtarasov/get-tag@v2.1 | |
id: tagName | |
- name: Build image | |
env: | |
TAGNAME: ${{ steps.tagName.outputs.tag }} | |
run: docker build --build-arg BUILD_VERSION=$TAGNAME --pull -t kooldev/kool:$TAGNAME -t kooldev/kool:4scan . | |
- name: Test image | |
env: | |
TAGNAME: ${{ steps.tagName.outputs.tag }} | |
run: docker run kooldev/kool:$TAGNAME kool --version | |
# - name: Scan image | |
# uses: anchore/scan-action@v2 | |
# with: | |
# image: "kooldev/kool:4scan" | |
# fail-build: true | |
# severity-cutoff: critical | |
- name: Push to hub | |
env: | |
TAGNAME: ${{ steps.tagName.outputs.tag }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
TAGNAME_MAJOR=${TAGNAME%%.*} | |
docker tag kooldev/kool:$TAGNAME kooldev/kool:$TAGNAME_MAJOR | |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin | |
docker push kooldev/kool:$TAGNAME | |
docker push kooldev/kool:$TAGNAME_MAJOR |