Skip to content

Swap out fishpond for eds #179

Swap out fishpond for eds

Swap out fishpond for eds #179

Workflow file for this run

name: Build Docker Image
# Every time something is merged to master or a tag is pushed, we build and push
# the Docker image
# For pull requests, we only build if the Dockerfile, renv.lock, or requirements.txt is modified
on:
push:
branches:
- main
- master
tags:
- "*"
pull_request:
branches:
- main
- master
paths:
- Dockerfile
- renv.lock
- requirements.txt
# 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"
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:
- name: Load 1Password secrets
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TRAINING_OP_SERVICE_ACCOUNT_TOKEN }}
DOCKER_USER: ${{ secrets.OP_DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.OP_DOCKER_PASSWORD }}
ACTION_MONITORING_SLACK: ${{ secrets.OP_ACTION_MONITORING_SLACK }}
# Login to Dockerhub
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USER }}
password: ${{ env.DOCKER_PASSWORD }}
# set up Docker build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ccdl/training_rstudio
# each github tag will create a matching tag on dockerhub,
# with the most recent given the "latest" tag
# the most recent push to master will get an "edge" tag
tags: |
type=ref,event=tag
type=edge,branch=master
# Build Docker image, push only on push events
- name: Build Docker image
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=ccdl/training_rstudio:buildcache
cache-to: type=registry,ref=ccdl/training_rstudio:buildcache,mode=max
# If we have a failure, Slack us
- name: Report failure to Slack
if: ${{ github.event_name == 'push' }}
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: "failure"
message_format: "Training build & push Docker workflow failed"
env:
SLACK_WEBHOOK_URL: ${{ env.ACTION_MONITORING_SLACK }}