Skip to content

Merge pull request #760 from AlexsLemonade/sjspielman/743-scintro-fixes #239

Merge pull request #760 from AlexsLemonade/sjspielman/743-scintro-fixes

Merge pull request #760 from AlexsLemonade/sjspielman/743-scintro-fixes #239

name: Build Docker Image and Push to Dockerhub
# Controls when the action will run.
# Every time something is merged to master, the image will be rebuilt and pushed.
on:
push:
branches:
- master
# 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: Checkout Repository
uses: actions/checkout@v3
- name: Load 1Password secrets
uses: 1password/load-secrets-action@v1
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@v2
with:
username: ${{ env.DOCKER_USER }}
password: ${{ env.DOCKER_PASSWORD }}
# set up Docker build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Build Docker image
- name: Build Docker image
uses: docker/build-push-action@v3
with:
push: true
context: .
file: Dockerfile
tags: ccdl/training_dev:latest
# If we have a failure, Slack us
- name: Report failure to Slack
if: always()
uses: ravsamhq/notify-slack-action@v1.1
with:
status: ${{ job.status }}
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ env.ACTION_MONITORING_SLACK }}
SLACK_MESSAGE: 'Training build Docker & push workflow failed'