Skip to content

Create and publish a Docker image #95

Create and publish a Docker image

Create and publish a Docker image #95

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Create and publish a Docker image
on:
push:
branches:
- main
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: docker/setup-buildx-action@3762d454f382a89982d79f33e1ff246835322c4d
- name: Log in to the Container registry
uses: docker/login-action@1f401f745bf57e30b3a2800ad308a87d2ebdf14b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@62339db73c56dd749060f65a6ebb93a6e056b755
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build Docker image locally
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: r-devel
push: false
load: true
tags: wch1/r-devel
- name: Build Docker image locally
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: r-debug-1
push: false
load: true
tags: wch1/r-debug-1
- name: Build Docker image locally
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: r-debug-2
push: false
load: true
tags: wch1/r-debug-2
- name: Build Docker image locally
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: r-debug-3
push: false
load: true
tags: wch1/r-debug-3
- name: Build Docker image locally
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: r-debug-4
push: false
load: true
tags: wch1/r-debug-4
- name: Build and push Docker image
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: r-debug
cache-from: ${{ ( github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' && 'type=gha' ) || '' }}
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}