Skip to content

Add Elm Land Docker example #1

Add Elm Land Docker example

Add Elm Land Docker example #1

name: Check and Build
on:
push:
branches:
- main
pull_request:
types:
- opened
# "synchronize" means new commits pushed to the HEAD of the pull request branch
- synchronize
env:
REGISTRY: ghcr.io
# What tags does:
# - always tag with sha
# - always tag with branch name
# - if a release tag is 'v1.0.0', then tag 'latest' and '1.0.0'
# More info: https://github.com/docker/metadata-action#tags-input
TAGS: |
type=sha
type=ref,event=branch
type=match,pattern=v(\d+),group=1
jobs:
build:
name: Build and Push Docker Images
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Prepare tags and labels
id: meta-webapp
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/vladimirlogachev/elm-land-docker-example
tags: ${{ env.TAGS }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta-webapp.outputs.tags }}
labels: ${{ steps.meta-webapp.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max