Skip to content

Keep execution going even if there is frozen positions #4488

Keep execution going even if there is frozen positions

Keep execution going even if there is frozen positions #4488

# Build notebook docker images.
#
# Only run with scripts/release.sh when v tag is added on the repo
#
# The label of the image is ghcr.io/tradingstrategy-ai/trading-strategy-notebook
#
#
name: Build Docker image for running Jupyter notebooks
on:
push:
branches: [ master ]
tags: [ v* ]
pull_request:
branches: [ master ]
jobs:
notebook-docker-image:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v')
env:
REGISTRY: ghcr.io
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Read metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Log in to Github Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://stackoverflow.com/a/58178121/315168
- name: Scrape build info
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: notebook.dockerfile
push: true
# latest tag add is added automatically
tags: |
ghcr.io/tradingstrategy-ai/trading-strategy-notebook:latest
ghcr.io/tradingstrategy-ai/trading-strategy-notebook:${{ env.RELEASE_VERSION }}
labels: ${{ steps.meta.outputs.labels }}
# experimental: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
cache-from: type=gha
cache-to: type=gha,mode=max
# https://stackoverflow.com/questions/67051284/how-to-set-a-dockerfile-arg-in-github-actions
# https://stackoverflow.com/a/63619526/315168
build-args: |
GIT_VERSION_TAG=${{ env.RELEASE_VERSION }}
GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }}
GIT_VERSION_HASH=${{ github.sha }}