Skip to content

Commit

Permalink
Setup reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensa committed Aug 3, 2022
1 parent 0712e72 commit 5502491
Showing 1 changed file with 6 additions and 59 deletions.
65 changes: 6 additions & 59 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,63 +11,10 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
# This workflow call reusable workflow docker-build
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v2

# Allow Buildx multi-platform builds
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

# Setup Buildx as the builder
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

# Avoid having to re-download docker images and reduces the number of pulls against Docker Hub
# https://github.com/actions/cache
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Use Personal Access Token (PAT) and username to log into Docker Hub
# https://github.com/docker/login-action
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

# Build and push action
# https://github.com/docker/build-push-action
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/ubuntu-tini-x11:latest
labels: maintainer=Ruben Suarez <[email protected]>
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

# Echo the image digest to see what was pushed
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
uses: rubensa/docker-ubuntu-tini/.github/workflows/docker-build.yml@master
with:
DOCKER_IMAGE_NAME: ubuntu-tini-x11
DOCKER_IMAGE_TAG: latest
secrets: inherit

0 comments on commit 5502491

Please sign in to comment.