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

Add docker build and publish on push #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
58 changes: 58 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: docker

on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
DOCKER_PUBLISH: true

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Disable docker publishing if in PR build
if: ${{ github.event_name == 'pull_request' }}
run: echo "Docker publishing in PR is disabled"
env:
DOCKER_PUBLISH: false

- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push docker image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: ${{ env.DOCKER_PUBLISH }}
tags: okmo/renode:latest
cache-from: type=registry,ref=okmo/renode:renodecache
cache-to: type=registry,ref=okmo/renode:renodecache,mode=max

- name: Build and push min renode image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.min
push: ${{ env.DOCKER_PUBLISH }}
tags: okmo/renodemin:latest
cache-from: type=registry,ref=okmo/renodemin:renodemincache
cache-to: type=registry,ref=okmo/renodemin:renodemincache,mode=max