Skip to content

Build docker image

Build docker image #49

name: Build docker image
"on":
workflow_dispatch:
# Follows https://github.com/lsst-sqre/build-and-push-to-ghcr
jobs:
build_container:
runs-on: ubuntu-latest
# See https://lsstc.slack.com/archives/C2JP8GGVC/p1698782669757349?thread_ts=1698779230.846079&cid=C2JP8GGVC
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.11"
auto-update-conda: true
channels: conda-forge,defaults
miniforge-variant: Mambaforge
use-mamba: true
channel-priority: strict
show-channel-urls: true
- name: Configure conda and install requirements
id: rs-install
shell: bash -l {0}
run: |
mamba install --quiet --file=requirements.txt
mamba install --quiet --file=test-requirements.txt
pip install lsst.resources
mamba list rubin-scheduler | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
echo "rs-version" `cat ${{ github.workspace }}/rs_version`
echo "rs-version=`cat ${{ github.workspace }}/rs_version`" >> $GITHUB_OUTPUT
- name: Access rubin-sched-data cache
id: cache-rs
uses: actions/cache@v4
env:
cache-name: cached-rubin-sched-data
with:
path: ~/rubin_sim_data
key: ${{ env.cache-name }}-v${{ steps.rs-install.outputs.rs-version }}
restore-keys: |
${{ env.cache-name }}-v
- name: Check and update cache contents.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
scheduler_download_data --update --tdqm_disable
# Docker image copies from github.workspace, not ~
cp -r ~/rubin_sim_data ${{ github.workspace }}/rubin_sim_data
- name: Report environment
shell: bash -l {0}
run: |
echo pwd is `pwd`
echo python is `which python`
echo github.workspace is ${{ github.workspace }}
find ${{ github.workspace }} -maxdepth 2
- uses: lsst-sqre/build-and-push-to-ghcr@tickets/DM-41857
id: build
with:
image: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Report build outputs
shell: bash -l {0}
run: |
echo Pushed ghcr.io/${{ github.repository }}:${{ steps.build.outputs.tag }}
echo Fully qualified image digest: ${{ steps.build.outputs.fully_qualified_image_digest }}
echo Tag of the image: ${{ steps.build.outputs.tag }}