Update Dockerfile #71
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: Publish CPU images | |
on: | |
workflow_dispatch: | |
# schedule: | |
# - cron: '0 3 * * 1' | |
# Run at 03:00 on Monday to update to latest jupyter/docker-stack? | |
push: | |
# Publish `main` branch as Docker `latest` image. | |
branches: | |
- main | |
# - dev | |
paths: | |
- 'Dockerfile' | |
- 'knowledge-graph/*' | |
- 'rstudio/*' | |
- 'jupyter_notebook_config.py' | |
- 'settings.json' | |
- '.github/workflows/docker.yml' | |
# # Publish `v1.2.3` tags as release `1.2.3`. | |
# tags: | |
# - v* | |
jobs: | |
build-and-publish-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
## Use Actions local caching with buildx | |
# - name: Cache Docker layers | |
# uses: actions/cache@v2 | |
# with: | |
# path: /tmp/.buildx-cache | |
# key: ${{ runner.os }}-buildx-${{ github.sha }} | |
# restore-keys: | | |
# ${{ runner.os }}-buildx- | |
- name: Login to the GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Generate image ID and version | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/jupyterlab | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=latest | |
echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
## Cache: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache | |
- name: Build and publish main latest Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
pull: true | |
push: true | |
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# cache-from: type=local,src=/tmp/.buildx-cache | |
# cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
# builder: ${{ steps.buildx.outputs.name }} | |
# Our custom Dockerfile for knowledge graphs | |
build-and-publish-graph: | |
needs: build-and-publish-latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Generate image ID and version | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/jupyterlab | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=knowledge-graph | |
echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Build and publish Knowledge Graph Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./knowledge-graph/Dockerfile | |
pull: true | |
push: true | |
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# builder: ${{ steps.buildx.outputs.name }} | |
# Our custom Dockerfile based on jupyter/r-notebook | |
build-and-publish-rstudio: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Generate image ID and version | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/jupyterlab | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=rstudio | |
echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Build and publish R notebook Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
build-args: BASE_IMAGE=jupyter/r-notebook | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
# tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }} | |
tags: ${{ env.IMAGE_ID }}:r-notebook | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=max | |
- name: Build and publish RStudio Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./rstudio/Dockerfile | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
# tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }} | |
tags: ${{ env.IMAGE_ID }}:rstudio | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=max |