Skip to content

Build and push Docker image #224

Build and push Docker image

Build and push Docker image #224

Workflow file for this run

name: Build and push Docker image
on:
push:
branches:
- main
- dev
paths:
# build if anything in ci/ changes except only environment.yml because
# environment-lock.yml needs to be built first by create-conda-lock.yml
- 'ci/**'
- '!ci/environment.yml'
- '.github/workflows/build.yml'
workflow_run:
workflows: ["update conda lockfile"]
types:
- completed
workflow_dispatch:
jobs:
build-and-push-docker:
if: ${{ github.event_name == 'push' || github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'}}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: "Set Job Environment Variables"
run: |
SHA7="${GITHUB_SHA::7}"
DOCKER_TAG=$SHA7
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v2
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
- name: "Login to Docker Hub"
uses: docker/login-action@v2
with:
username: openscapes
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Build and push"
uses: docker/build-push-action@v4
with:
context: ci
push: true
tags: openscapes/python:latest, openscapes/python:${{ env.DOCKER_TAG }}
- name: Export Full Conda Environment
run: |
docker run openscapes/python:main conda list --export