Merge pull request #34 from NASA-Openscapes/dev #186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push Docker image | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
build-and-push-docker: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: "3.10" | |
channels: conda-forge | |
miniforge-variant: Mambaforge | |
environment-file: ci/environment-lock.yml | |
activate-environment: env-lock | |
- name: "Create conda-locks" | |
working-directory: ./ci | |
run: | | |
find environments -mindepth 1 -maxdepth 1 -type d | xargs -I % sh -c "cd %; conda-lock -k explicit -f environment.yml" | |
- 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 |