.github/workflows/docker-test-build.yml #300
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 build image | ||
on: workflow_dispach | ||
jobs: | ||
test-build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
registry: ${{ env.REGISTRY }} | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/universc:test | ||
push: false | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
- name: Status | ||
run: echo "build complete" | ||
- name: Hello world | ||
run: docker run ${{ secrets.DOCKER_HUB_USERNAME }}/universc:test echo "hello world" | ||
test-build-cache: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
registry: ${{ env.REGISTRY }} | ||
- uses: satackey/[email protected] | ||
# Ignore the failure of a step and avoid terminating the job. | ||
continue-on-error: true | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag universc:$(date +%s) | ||
- uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Build from cache | ||
uses: whoan/docker-build-with-cache-action@v5 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} whoan | ||
password: "${{ secrets.GITHUB_TOKEN }}" | ||
registry: docker.pkg.github.com | ||
image_name: test | ||
- name: Build from cache | ||
uses: whoan/docker-build-with-cache-action@v5 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
registry: ${{ env.REGISTRY }} | ||
dockerfile: ./Dockerfile | ||
image_name: test | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
- name: Status | ||
run: echo "build complete" | ||
- name: Hello world | ||
run: docker run ${{ secrets.DOCKER_HUB_USERNAME }}/universc:test echo "hello world" | ||
test-call: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-buildx-action@v1 | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
registry: ${{ env.REGISTRY }} | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag universc:test | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
- name: Status | ||
run: echo "build complete" | ||
- name: Call functions | ||
run: docker run universc:test bash /universc/test/test_call.sh | ||