mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 01:55:56 +08:00
Add nightly release (#2739)
This commit is contained in:
parent
c1fd9bc61e
commit
915cec327d
57
.github/workflows/assets.yml
vendored
Normal file
57
.github/workflows/assets.yml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
name: Assets
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- "v*.*"
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
outputs:
|
||||||
|
sha: ${{ steps.push_assets.outputs.commit_hash }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: |
|
||||||
|
. versions
|
||||||
|
echo "elixir=$elixir" >> $GITHUB_ENV
|
||||||
|
echo "otp=$otp" >> $GITHUB_ENV
|
||||||
|
- name: Install Erlang & Elixir
|
||||||
|
uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: ${{ env.otp }}
|
||||||
|
elixir-version: ${{ env.elixir }}
|
||||||
|
- name: Cache Mix
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
deps
|
||||||
|
_build
|
||||||
|
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
|
||||||
|
# Note: we need to get Phoenix and LV because package.json points to them directly
|
||||||
|
- name: Install mix dependencies
|
||||||
|
run: mix deps.get
|
||||||
|
- name: Install Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20.x"
|
||||||
|
- name: Cache npm dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- name: Clean generated assets
|
||||||
|
run: rm -rf static/assets
|
||||||
|
- name: Install npm dependencies
|
||||||
|
run: npm ci --prefix assets
|
||||||
|
- name: Build assets
|
||||||
|
run: npm run deploy --prefix assets
|
||||||
|
- name: Push updated assets
|
||||||
|
id: push_assets
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
|
with:
|
||||||
|
commit_message: Update assets
|
||||||
|
file_pattern: static
|
124
.github/workflows/deploy.yml
vendored
124
.github/workflows/deploy.yml
vendored
|
@ -1,124 +0,0 @@
|
||||||
name: Deploy
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- "v*.*"
|
|
||||||
tags:
|
|
||||||
- "v*.*.*"
|
|
||||||
jobs:
|
|
||||||
assets:
|
|
||||||
outputs:
|
|
||||||
sha: ${{ steps.push_assets.outputs.commit_hash }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- run: |
|
|
||||||
. versions
|
|
||||||
echo "elixir=$elixir" >> $GITHUB_ENV
|
|
||||||
echo "otp=$otp" >> $GITHUB_ENV
|
|
||||||
- name: Install Erlang & Elixir
|
|
||||||
uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
otp-version: ${{ env.otp }}
|
|
||||||
elixir-version: ${{ env.elixir }}
|
|
||||||
- name: Cache Mix
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
deps
|
|
||||||
_build
|
|
||||||
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
|
|
||||||
# Note: we need to get Phoenix and LV because package.json points to them directly
|
|
||||||
- name: Install mix dependencies
|
|
||||||
run: mix deps.get
|
|
||||||
- name: Install Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: "18.x"
|
|
||||||
- name: Cache npm dependencies
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node-
|
|
||||||
- name: Clean generated assets
|
|
||||||
run: rm -rf static/assets
|
|
||||||
- name: Install npm dependencies
|
|
||||||
run: npm ci --prefix assets
|
|
||||||
- name: Build assets
|
|
||||||
run: npm run deploy --prefix assets
|
|
||||||
- name: Push updated assets
|
|
||||||
id: push_assets
|
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
|
||||||
with:
|
|
||||||
commit_message: Update assets
|
|
||||||
file_pattern: static
|
|
||||||
docker:
|
|
||||||
if: github.ref_type == 'tag' || github.ref == 'refs/heads/main'
|
|
||||||
# The assets job may push new commit, so we wait for it
|
|
||||||
needs: [assets]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
# The output is set only if there was a commit, otherwise
|
|
||||||
# we pass an empty ref and and the default is used
|
|
||||||
ref: ${{ needs.assets.outputs.sha }}
|
|
||||||
- run: |
|
|
||||||
. versions
|
|
||||||
echo "elixir=$elixir" >> $GITHUB_ENV
|
|
||||||
echo "otp=$otp" >> $GITHUB_ENV
|
|
||||||
echo "debian=$debian" >> $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 GitHub Container Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v3
|
|
||||||
with:
|
|
||||||
images: ghcr.io/livebook-dev/livebook
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=edge,branch=main
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
build-args: |
|
|
||||||
BASE_IMAGE=hexpm/elixir:${{ env.elixir }}-erlang-${{ env.otp }}-debian-${{ env.debian }}
|
|
||||||
|
|
||||||
create_draft_release:
|
|
||||||
if: github.ref_type == 'tag'
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
|
|
||||||
steps:
|
|
||||||
- name: Create draft release
|
|
||||||
run: |
|
|
||||||
gh release create \
|
|
||||||
--repo ${{ github.repository }} \
|
|
||||||
--title ${{ github.ref_name }} \
|
|
||||||
--draft \
|
|
||||||
${{ github.ref_name }}
|
|
||||||
|
|
||||||
- name: Trigger desktop builds
|
|
||||||
run: |
|
|
||||||
gh workflow run -R livebook-dev/livebook_cd build.yml -f ref_name=${{ github.ref_name }}
|
|
95
.github/workflows/release.yml
vendored
Normal file
95
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
schedule:
|
||||||
|
# Daily at 00:00
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
# Workflow dispatch always builds as nightly
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
create_draft_release:
|
||||||
|
if: github.ref_type == 'tag'
|
||||||
|
name: "Create draft release"
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- name: Create draft release
|
||||||
|
run: |
|
||||||
|
gh release create \
|
||||||
|
--repo ${{ github.repository }} \
|
||||||
|
--title ${{ github.ref_name }} \
|
||||||
|
--draft \
|
||||||
|
${{ github.ref_name }}
|
||||||
|
|
||||||
|
docker:
|
||||||
|
name: Docker (${{ matrix.name }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: "default"
|
||||||
|
suffix: ""
|
||||||
|
build_args: |
|
||||||
|
VARIANT=default
|
||||||
|
- name: "cuda12"
|
||||||
|
tag_suffix: "-cuda12"
|
||||||
|
build_args: |
|
||||||
|
VARIANT=cuda
|
||||||
|
CUDA_VERSION=12-1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: |
|
||||||
|
. versions
|
||||||
|
echo "elixir=$elixir" >> $GITHUB_ENV
|
||||||
|
echo "otp=$otp" >> $GITHUB_ENV
|
||||||
|
echo "ubuntu=$ubuntu" >> $GITHUB_ENV
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ghcr.io/livebook-dev/livebook
|
||||||
|
flavor: |
|
||||||
|
suffix=${{ matrix.tag_suffix }}
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=raw,value=nightly,enable=${{ github.ref_type != 'tag' }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=hexpm/elixir:${{ env.elixir }}-erlang-${{ env.otp }}-ubuntu-${{ env.ubuntu }}
|
||||||
|
${{ matrix.build_args }}
|
||||||
|
|
||||||
|
desktop:
|
||||||
|
name: "Desktop"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Trigger desktop builds
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
||||||
|
gh workflow run -R livebook-dev/livebook_cd build.yml -f ref_name=${{ github.ref_name }}
|
||||||
|
else
|
||||||
|
gh workflow run -R livebook-dev/livebook_cd build.yml -f ref_name=${{ github.sha }} -f release_name=nightly
|
||||||
|
fi
|
22
.github/workflows/test.yml
vendored
22
.github/workflows/test.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
ELIXIR_ERL_OPTIONS: "-epmd_module Elixir.Livebook.EPMD"
|
ELIXIR_ERL_OPTIONS: "-epmd_module Elixir.Livebook.EPMD"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout git repo
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Read ./versions
|
- name: Read ./versions
|
||||||
run: |
|
run: |
|
||||||
. versions
|
. versions
|
||||||
|
@ -26,7 +26,7 @@ jobs:
|
||||||
otp-version: ${{ env.otp }}
|
otp-version: ${{ env.otp }}
|
||||||
elixir-version: ${{ env.elixir }}
|
elixir-version: ${{ env.elixir }}
|
||||||
- name: Cache Mix
|
- name: Cache Mix
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
deps
|
deps
|
||||||
|
@ -43,11 +43,11 @@ jobs:
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: mix test
|
run: mix test
|
||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: "18.x"
|
node-version: "20.x"
|
||||||
- name: Cache npm dependencies
|
- name: Cache npm dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
@ -70,7 +70,7 @@ jobs:
|
||||||
- name: Configure Git
|
- name: Configure Git
|
||||||
run: git config --global core.autocrlf input
|
run: git config --global core.autocrlf input
|
||||||
- name: Checkout git repo
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Read ./versions
|
- name: Read ./versions
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
@ -92,7 +92,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
"C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
"C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||||
- name: Cache Mix
|
- name: Cache Mix
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
deps
|
deps
|
||||||
|
@ -113,7 +113,7 @@ jobs:
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout git repo
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Read ./versions
|
- name: Read ./versions
|
||||||
run: |
|
run: |
|
||||||
. versions
|
. versions
|
||||||
|
@ -121,17 +121,17 @@ jobs:
|
||||||
echo "otp=$otp" >> $GITHUB_ENV
|
echo "otp=$otp" >> $GITHUB_ENV
|
||||||
echo "openssl=$openssl" >> $GITHUB_ENV
|
echo "openssl=$openssl" >> $GITHUB_ENV
|
||||||
- name: Cache Mix Deps
|
- name: Cache Mix Deps
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: deps
|
path: deps
|
||||||
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
||||||
- name: Cache Bootstrap OTP
|
- name: Cache Bootstrap OTP
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: elixirkit/otp_bootstrap/_build/otp-rel-${{ env.otp }}-openssl-${{ env.openssl }}-macos-universal
|
path: elixirkit/otp_bootstrap/_build/otp-rel-${{ env.otp }}-openssl-${{ env.openssl }}-macos-universal
|
||||||
key: ${{ runner.os }}-bootstrap-${{ env.otp }}-${{ hashFiles('elixirkit/otp_bootstrap/build.sh') }}
|
key: ${{ runner.os }}-bootstrap-${{ env.otp }}-${{ hashFiles('elixirkit/otp_bootstrap/build.sh') }}
|
||||||
- name: Cache Elixir
|
- name: Cache Elixir
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: _build/elixir-${{ env.elixir }}
|
path: _build/elixir-${{ env.elixir }}
|
||||||
key: ${{ runner.os }}-elixir-${{ env.elixir }}
|
key: ${{ runner.os }}-elixir-${{ env.elixir }}
|
||||||
|
|
17
.github/workflows/uffizzi-build.yml
vendored
17
.github/workflows/uffizzi-build.yml
vendored
|
@ -12,12 +12,12 @@ jobs:
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout git repo
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- run: |
|
- run: |
|
||||||
. versions
|
. versions
|
||||||
echo "elixir=$elixir" >> $GITHUB_ENV
|
echo "elixir=$elixir" >> $GITHUB_ENV
|
||||||
echo "otp=$otp" >> $GITHUB_ENV
|
echo "otp=$otp" >> $GITHUB_ENV
|
||||||
echo "debian=$debian" >> $GITHUB_ENV
|
echo "ubuntu=$ubuntu" >> $GITHUB_ENV
|
||||||
# --- START build assets
|
# --- START build assets
|
||||||
- name: Install Erlang & Elixir
|
- name: Install Erlang & Elixir
|
||||||
uses: erlef/setup-beam@v1
|
uses: erlef/setup-beam@v1
|
||||||
|
@ -25,7 +25,7 @@ jobs:
|
||||||
otp-version: ${{ env.otp }}
|
otp-version: ${{ env.otp }}
|
||||||
elixir-version: ${{ env.elixir }}
|
elixir-version: ${{ env.elixir }}
|
||||||
- name: Cache Mix
|
- name: Cache Mix
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
deps
|
deps
|
||||||
|
@ -37,11 +37,11 @@ jobs:
|
||||||
- name: Install mix dependencies
|
- name: Install mix dependencies
|
||||||
run: mix deps.get
|
run: mix deps.get
|
||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: "18.x"
|
node-version: "20.x"
|
||||||
- name: Cache npm dependencies
|
- name: Cache npm dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
@ -76,7 +76,8 @@ jobs:
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
build-args: |
|
build-args: |
|
||||||
BASE_IMAGE=hexpm/elixir:${{ env.elixir }}-erlang-${{ env.otp }}-debian-${{ env.debian }}
|
BASE_IMAGE=hexpm/elixir:${{ env.elixir }}-erlang-${{ env.otp }}-ubuntu-${{ env.ubuntu }}
|
||||||
|
VARIANT=default
|
||||||
|
|
||||||
render-compose-file:
|
render-compose-file:
|
||||||
name: Render Docker Compose file
|
name: Render Docker Compose file
|
||||||
|
@ -86,7 +87,7 @@ jobs:
|
||||||
- build-application
|
- build-application
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout git repo
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Render Compose File
|
- name: Render Compose File
|
||||||
run: |
|
run: |
|
||||||
APP_IMAGE=$(echo ${{ needs.build-application.outputs.tags }})
|
APP_IMAGE=$(echo ${{ needs.build-application.outputs.tags }})
|
||||||
|
|
2
.github/workflows/uffizzi-preview.yml
vendored
2
.github/workflows/uffizzi-preview.yml
vendored
|
@ -59,7 +59,7 @@ jobs:
|
||||||
echo "COMPOSE_FILE_HASH=$(md5sum docker-compose.rendered.yml | awk '{ print $1 }')" >> $GITHUB_OUTPUT
|
echo "COMPOSE_FILE_HASH=$(md5sum docker-compose.rendered.yml | awk '{ print $1 }')" >> $GITHUB_OUTPUT
|
||||||
- name: Cache Rendered Compose File
|
- name: Cache Rendered Compose File
|
||||||
if: ${{ steps.event.outputs.ACTION != 'closed' }}
|
if: ${{ steps.event.outputs.ACTION != 'closed' }}
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: docker-compose.rendered.yml
|
path: docker-compose.rendered.yml
|
||||||
key: ${{ steps.hash.outputs.COMPOSE_FILE_HASH }}
|
key: ${{ steps.hash.outputs.COMPOSE_FILE_HASH }}
|
||||||
|
|
96
Dockerfile
96
Dockerfile
|
@ -1,15 +1,34 @@
|
||||||
ARG BASE_IMAGE
|
ARG BASE_IMAGE
|
||||||
|
ARG VARIANT
|
||||||
|
|
||||||
# Stage 1
|
# Pre-stages for base image variants
|
||||||
# Builds the Livebook release
|
|
||||||
FROM ${BASE_IMAGE} AS build
|
FROM ${BASE_IMAGE} as base-default
|
||||||
|
|
||||||
|
FROM ${BASE_IMAGE} as base-cuda
|
||||||
|
|
||||||
|
ARG CUDA_VERSION
|
||||||
|
|
||||||
|
RUN distro="ubuntu$(. /etc/lsb-release; echo "$DISTRIB_RELEASE" | tr -d '.')" && \
|
||||||
|
# Official Docker images use the sbsa packages when targetting arm64.
|
||||||
|
# See https://gitlab.com/nvidia/container-images/cuda/-/blob/85f465ea3343a2d7f7753a0a838701999ed58a01/dist/12.5.1/ubuntu2204/base/Dockerfile#L12
|
||||||
|
arch="$(if [ "$(uname -m)" = "aarch64" ]; then echo "sbsa"; else echo "x86_64"; fi)" && \
|
||||||
|
apt update -q && apt install -y ca-certificates wget && \
|
||||||
|
wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb && \
|
||||||
|
dpkg -i /tmp/cuda-keyring.deb && apt update -q
|
||||||
|
|
||||||
|
# In order to minimize the image size, we install only a subset of
|
||||||
|
# the CUDA toolkit that is required by Elixir numerical packages
|
||||||
|
# (nvcc and runtime libraries). Note that we do not need to install
|
||||||
|
# the driver, it is already provided by NVIDIA Container Toolkit.
|
||||||
|
RUN apt install -y git cuda-nvcc-${CUDA_VERSION} cuda-libraries-${CUDA_VERSION} libcudnn8
|
||||||
|
|
||||||
|
# Build stage: builds the release
|
||||||
|
FROM base-${VARIANT} AS build
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y && \
|
RUN apt-get update && apt-get upgrade -y && \
|
||||||
apt-get install --no-install-recommends -y \
|
apt-get install --no-install-recommends -y \
|
||||||
build-essential git && \
|
build-essential git
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
|
||||||
apt-get clean -y && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
@ -39,49 +58,52 @@ COPY static static
|
||||||
COPY iframe/priv/static/iframe iframe/priv/static/iframe
|
COPY iframe/priv/static/iframe iframe/priv/static/iframe
|
||||||
COPY proto proto
|
COPY proto proto
|
||||||
COPY lib lib
|
COPY lib lib
|
||||||
# We need README.md during compilation
|
# We need README.md during compilation (look for @external_resource "README.md")
|
||||||
# (look for @external_resource "README.md")
|
|
||||||
COPY README.md README.md
|
COPY README.md README.md
|
||||||
RUN mix do compile, release livebook
|
RUN mix do compile, release livebook
|
||||||
|
|
||||||
# Stage 2
|
# Final stage: prepares the runtime environment and copies over the release.
|
||||||
# Prepares the runtime environment and copies over the release.
|
#
|
||||||
# We use the same base image, because we need Erlang, Elixir and Mix
|
# As opposed to usual deployments with Elixir releases, we want Erlang,
|
||||||
# during runtime to spawn the Livebook standalone runtimes.
|
# Elixir and Mix to be available in the runtime image, because those
|
||||||
# Consequently the release doesn't include ERTS as we have it anyway.
|
# are required for the Livebook runtimes. Consequently, we build the
|
||||||
FROM ${BASE_IMAGE}
|
# release with `include_erts: false`.
|
||||||
|
FROM base-${VARIANT}
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y && \
|
RUN apt-get update && apt-get upgrade -y && \
|
||||||
apt-get install --no-install-recommends -y \
|
apt-get install --no-install-recommends -y \
|
||||||
# Runtime dependencies
|
# Runtime dependencies
|
||||||
build-essential ca-certificates libncurses5-dev \
|
build-essential ca-certificates libncurses5-dev \
|
||||||
# In case someone uses `Mix.install/2` and point to a git repo
|
# In case someone uses `Mix.install/2` and point to a git repo
|
||||||
git \
|
git \
|
||||||
# Additional standard tools
|
# Additional standard tools
|
||||||
wget \
|
wget \
|
||||||
# In case someone uses Torchx for Nx
|
# In case someone uses Torchx for Nx
|
||||||
cmake && \
|
cmake && \
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
||||||
apt-get clean -y && \
|
apt-get clean -y && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Run in the /data directory by default, makes for
|
# Run in the /data directory by default, makes for a good place for
|
||||||
# a good place for the user to mount local volume
|
# the user to mount local volume
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
ENV HOME=/home/livebook
|
ENV HOME=/home/livebook
|
||||||
# Make sure someone running the container with `--user`
|
# Make sure someone running the container with `--user` has permissions
|
||||||
# has permissions to the home dir (for `Mix.install/2` cache)
|
# to the home dir (for `Mix.install/2` cache)
|
||||||
RUN mkdir $HOME && chmod 777 $HOME
|
RUN mkdir $HOME && chmod 777 $HOME
|
||||||
|
|
||||||
# Install hex and rebar for `Mix.install/2` and Mix runtime
|
# Install hex and rebar for `Mix.install/2` and Mix runtime
|
||||||
RUN mix local.hex --force && \
|
RUN mix local.hex --force && \
|
||||||
mix local.rebar --force
|
mix local.rebar --force
|
||||||
|
|
||||||
# Override the default 127.0.0.1 address, so that the app
|
# By default Livebook binds to loopback, but in order to make the app
|
||||||
# can be accessed outside the container by binding ports
|
# accessible outside of the container (by binding ports), we need to
|
||||||
|
# bind to any address. Also note that we specify IPv6 address, becuase
|
||||||
|
# we want to accept IPv6 connections. This is actually the default in
|
||||||
|
# usual Phoenix deployments.
|
||||||
ENV LIVEBOOK_IP="::"
|
ENV LIVEBOOK_IP="::"
|
||||||
|
|
||||||
ENV LIVEBOOK_HOME=/data
|
ENV LIVEBOOK_HOME=/data
|
||||||
|
@ -89,8 +111,8 @@ ENV LIVEBOOK_HOME=/data
|
||||||
# Copy the release build from the previous stage
|
# Copy the release build from the previous stage
|
||||||
COPY --from=build /app/_build/prod/rel/livebook /app
|
COPY --from=build /app/_build/prod/rel/livebook /app
|
||||||
|
|
||||||
# Make release files available to any user, in case someone
|
# Make release files available to any user, in case someone runs the
|
||||||
# runs the container with `--user`
|
# container with `--user`
|
||||||
RUN chmod -R go=u /app
|
RUN chmod -R go=u /app
|
||||||
# Make all home files available (specifically .mix/)
|
# Make all home files available (specifically .mix/)
|
||||||
RUN chmod -R go=u $HOME
|
RUN chmod -R go=u $HOME
|
||||||
|
|
|
@ -77,7 +77,7 @@ To deploy Livebook on your cloud platform, see our [Docker Deployment](docs/depl
|
||||||
For CUDA support, [see images with the "cuda" tag](https://github.com/livebook-dev/livebook/pkgs/container/livebook).
|
For CUDA support, [see images with the "cuda" tag](https://github.com/livebook-dev/livebook/pkgs/container/livebook).
|
||||||
|
|
||||||
To try out features from the main branch you can alternatively
|
To try out features from the main branch you can alternatively
|
||||||
use the `ghcr.io/livebook-dev/livebook:edge` image.
|
use the `ghcr.io/livebook-dev/livebook:nightly` image.
|
||||||
See [Livebook images](https://github.com/livebook-dev/livebook/pkgs/container/livebook).
|
See [Livebook images](https://github.com/livebook-dev/livebook/pkgs/container/livebook).
|
||||||
|
|
||||||
### Embedded devices
|
### Embedded devices
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
ARG ELIXIR_VERSION
|
|
||||||
ARG ERLANG_VERSION
|
|
||||||
ARG UBUNTU_VERSION
|
|
||||||
|
|
||||||
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-ubuntu-${UBUNTU_VERSION}
|
|
||||||
|
|
||||||
ARG CUDA_VERSION
|
|
||||||
|
|
||||||
RUN distro="ubuntu$(. /etc/lsb-release; echo "$DISTRIB_RELEASE" | tr -d '.')" && \
|
|
||||||
# Official Docker images use the sbsa packages when targetting arm64.
|
|
||||||
# See https://gitlab.com/nvidia/container-images/cuda/-/blob/85f465ea3343a2d7f7753a0a838701999ed58a01/dist/12.5.1/ubuntu2204/base/Dockerfile#L12
|
|
||||||
arch="$(if [ "$(uname -m)" = "aarch64" ]; then echo "sbsa"; else echo "x86_64"; fi)" && \
|
|
||||||
apt update -q && apt install -y ca-certificates wget && \
|
|
||||||
wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb && \
|
|
||||||
dpkg -i /tmp/cuda-keyring.deb && apt update -q
|
|
||||||
|
|
||||||
# In order to minimize the image size, we install only a subset of
|
|
||||||
# the CUDA toolkit that is required by Elixir numerical packages
|
|
||||||
# (nvcc and runtime libraries). Note that we do not need to install
|
|
||||||
# the driver, it is already provided by NVIDIA Container Toolkit.
|
|
||||||
RUN apt install -y git cuda-nvcc-${CUDA_VERSION} cuda-libraries-${CUDA_VERSION} libcudnn8
|
|
|
@ -1,69 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Builds extra Livebook images.
|
|
||||||
#
|
|
||||||
# Images are pushed to GHCR, so you need to make sure that the docker
|
|
||||||
# client is authenticated.
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
cd "$(dirname "$0")/.."
|
|
||||||
|
|
||||||
. versions
|
|
||||||
|
|
||||||
livebook_version="$(cat mix.exs | grep '@version "' | grep -o '".*"' | tr -d '"')"
|
|
||||||
|
|
||||||
if [ -z "$livebook_version" ] || [[ "$livebook_version" == *"dev"* ]]; then
|
|
||||||
echo "No releasable Livebook version detected"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$livebook_version" == *"-"* ]]; then
|
|
||||||
stable=false
|
|
||||||
else
|
|
||||||
stable=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
cuda_tag_list=("cuda11.8" "cuda12.1")
|
|
||||||
cuda_version_list=("11-8" "12-1")
|
|
||||||
|
|
||||||
for idx in "${!cuda_tag_list[@]}"; do
|
|
||||||
cuda_tag="${cuda_tag_list[idx]}"
|
|
||||||
cuda_version="${cuda_version_list[idx]}"
|
|
||||||
|
|
||||||
base_image="ghcr.io/livebook-dev/utils:elixir-$elixir-erlang-$otp-$cuda_tag"
|
|
||||||
|
|
||||||
if docker manifest inspect $base_image > /dev/null; then
|
|
||||||
echo "Using base image: $base_image"
|
|
||||||
else
|
|
||||||
echo "Building base image: $base_image"
|
|
||||||
|
|
||||||
docker buildx build --push --platform linux/amd64,linux/arm64 \
|
|
||||||
-t $base_image \
|
|
||||||
--build-arg ELIXIR_VERSION=$elixir \
|
|
||||||
--build-arg ERLANG_VERSION=$otp \
|
|
||||||
--build-arg UBUNTU_VERSION=$ubuntu \
|
|
||||||
--build-arg CUDA_VERSION=$cuda_version \
|
|
||||||
-f docker/base/elixir-cuda.dockerfile \
|
|
||||||
docker/base
|
|
||||||
fi
|
|
||||||
|
|
||||||
image="ghcr.io/livebook-dev/livebook:$livebook_version-$cuda_tag"
|
|
||||||
|
|
||||||
if docker manifest inspect $image > /dev/null; then
|
|
||||||
echo "Skipping image, since it already exists: $image"
|
|
||||||
else
|
|
||||||
echo "Building image: $image"
|
|
||||||
|
|
||||||
extra_args=""
|
|
||||||
|
|
||||||
if [[ "$stable" == "true" ]]; then
|
|
||||||
extra_args="-t ghcr.io/livebook-dev/livebook:latest-$cuda_tag"
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker buildx build --push --platform linux/amd64,linux/arm64 \
|
|
||||||
--build-arg BASE_IMAGE="$base_image" \
|
|
||||||
-t $image \
|
|
||||||
$extra_args \
|
|
||||||
.
|
|
||||||
fi
|
|
||||||
done
|
|
|
@ -61,23 +61,13 @@ defmodule Livebook.Config do
|
||||||
def docker_images() do
|
def docker_images() do
|
||||||
version = app_version()
|
version = app_version()
|
||||||
|
|
||||||
{version, version_cuda} =
|
version = if version =~ "dev", do: "nightly", else: version
|
||||||
if version =~ "dev" do
|
|
||||||
{"edge", "latest"}
|
|
||||||
else
|
|
||||||
{version, version}
|
|
||||||
end
|
|
||||||
|
|
||||||
[
|
[
|
||||||
%{tag: version, name: "Livebook", env: []},
|
%{tag: version, name: "Livebook", env: []},
|
||||||
%{
|
%{
|
||||||
tag: "#{version_cuda}-cuda11.8",
|
tag: "#{version}-cuda12",
|
||||||
name: "Livebook + CUDA 11.8",
|
name: "Livebook + CUDA 12",
|
||||||
env: [{"XLA_TARGET", "cuda118"}]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
tag: "#{version_cuda}-cuda12.1",
|
|
||||||
name: "Livebook + CUDA 12.1",
|
|
||||||
env: [{"XLA_TARGET", "cuda120"}]
|
env: [{"XLA_TARGET", "cuda120"}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -7,9 +7,9 @@ defmodule Livebook.Hubs.DockerfileTest do
|
||||||
alias Livebook.Hubs
|
alias Livebook.Hubs
|
||||||
alias Livebook.Secrets.Secret
|
alias Livebook.Secrets.Secret
|
||||||
|
|
||||||
@versions if Livebook.Config.app_version() =~ "-dev",
|
@version if Livebook.Config.app_version() =~ "-dev",
|
||||||
do: %{base: "edge", cuda: "latest"},
|
do: "nightly",
|
||||||
else: %{base: Livebook.Config.app_version(), cuda: Livebook.Config.app_version()}
|
else: Livebook.Config.app_version()
|
||||||
|
|
||||||
describe "airgapped_dockerfile/7" do
|
describe "airgapped_dockerfile/7" do
|
||||||
test "deploying a single notebook in personal hub" do
|
test "deploying a single notebook in personal hub" do
|
||||||
|
@ -20,7 +20,7 @@ defmodule Livebook.Hubs.DockerfileTest do
|
||||||
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
|
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
|
||||||
|
|
||||||
assert dockerfile == """
|
assert dockerfile == """
|
||||||
FROM ghcr.io/livebook-dev/livebook:#{@versions.base}
|
FROM ghcr.io/livebook-dev/livebook:#{@version}
|
||||||
|
|
||||||
# Apps configuration
|
# Apps configuration
|
||||||
ENV LIVEBOOK_APPS_PATH "/apps"
|
ENV LIVEBOOK_APPS_PATH "/apps"
|
||||||
|
@ -97,7 +97,7 @@ defmodule Livebook.Hubs.DockerfileTest do
|
||||||
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
|
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
|
||||||
|
|
||||||
assert dockerfile == """
|
assert dockerfile == """
|
||||||
FROM ghcr.io/livebook-dev/livebook:#{@versions.base}
|
FROM ghcr.io/livebook-dev/livebook:#{@version}
|
||||||
|
|
||||||
ARG TEAMS_KEY="lb_tk_fn0pL3YLWzPoPFWuHeV3kd0o7_SFuIOoU4C_k6OWDYg"
|
ARG TEAMS_KEY="lb_tk_fn0pL3YLWzPoPFWuHeV3kd0o7_SFuIOoU4C_k6OWDYg"
|
||||||
|
|
||||||
|
@ -166,16 +166,16 @@ defmodule Livebook.Hubs.DockerfileTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deploying with different base image" do
|
test "deploying with different base image" do
|
||||||
config = dockerfile_config(%{docker_tag: "#{@versions.cuda}-cuda11.8"})
|
config = dockerfile_config(%{docker_tag: "#{@version}-cuda12"})
|
||||||
hub = personal_hub()
|
hub = personal_hub()
|
||||||
file = Livebook.FileSystem.File.local(p("/notebook.livemd"))
|
file = Livebook.FileSystem.File.local(p("/notebook.livemd"))
|
||||||
|
|
||||||
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
|
dockerfile = Dockerfile.airgapped_dockerfile(config, hub, [], [], file, [], %{})
|
||||||
|
|
||||||
assert dockerfile =~ """
|
assert dockerfile =~ """
|
||||||
FROM ghcr.io/livebook-dev/livebook:#{@versions.cuda}-cuda11.8
|
FROM ghcr.io/livebook-dev/livebook:#{@version}-cuda12
|
||||||
|
|
||||||
ENV XLA_TARGET "cuda118"
|
ENV XLA_TARGET "cuda120"
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -247,14 +247,14 @@ defmodule Livebook.Hubs.DockerfileTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deploying with different base image" do
|
test "deploying with different base image" do
|
||||||
config = dockerfile_config(%{docker_tag: "#{@versions.cuda}-cuda11.8"})
|
config = dockerfile_config(%{docker_tag: "#{@version}-cuda12"})
|
||||||
hub = team_hub()
|
hub = team_hub()
|
||||||
agent_key = Livebook.Factory.build(:agent_key)
|
agent_key = Livebook.Factory.build(:agent_key)
|
||||||
|
|
||||||
%{image: image, env: env} = Dockerfile.online_docker_info(config, hub, agent_key)
|
%{image: image, env: env} = Dockerfile.online_docker_info(config, hub, agent_key)
|
||||||
|
|
||||||
assert image == "ghcr.io/livebook-dev/livebook:#{@versions.cuda}-cuda11.8"
|
assert image == "ghcr.io/livebook-dev/livebook:#{@version}-cuda12"
|
||||||
assert {"XLA_TARGET", "cuda118"} in env
|
assert {"XLA_TARGET", "cuda120"} in env
|
||||||
end
|
end
|
||||||
|
|
||||||
test "deploying with auto cluster setup" do
|
test "deploying with auto cluster setup" do
|
||||||
|
|
|
@ -73,7 +73,7 @@ defmodule Livebook.Runtime.FlyTest do
|
||||||
gpu_kind: nil,
|
gpu_kind: nil,
|
||||||
gpus: nil,
|
gpus: nil,
|
||||||
volume_id: nil,
|
volume_id: nil,
|
||||||
docker_tag: "edge"
|
docker_tag: "nightly"
|
||||||
}
|
}
|
||||||
|
|
||||||
Map.merge(defaults, attrs)
|
Map.merge(defaults, attrs)
|
||||||
|
|
|
@ -1111,7 +1111,7 @@ defmodule LivebookWeb.SessionLiveTest do
|
||||||
gpu_kind: nil,
|
gpu_kind: nil,
|
||||||
gpus: nil,
|
gpus: nil,
|
||||||
volume_id: "vol_1",
|
volume_id: "vol_1",
|
||||||
docker_tag: "edge"
|
docker_tag: "nightly"
|
||||||
})
|
})
|
||||||
|
|
||||||
Session.set_runtime(session.pid, runtime)
|
Session.set_runtime(session.pid, runtime)
|
||||||
|
@ -1183,7 +1183,7 @@ defmodule LivebookWeb.SessionLiveTest do
|
||||||
gpu_kind: nil,
|
gpu_kind: nil,
|
||||||
gpus: nil,
|
gpus: nil,
|
||||||
volume_id: "vol_1",
|
volume_id: "vol_1",
|
||||||
docker_tag: "edge"
|
docker_tag: "nightly"
|
||||||
})
|
})
|
||||||
|
|
||||||
Session.set_runtime(session.pid, runtime)
|
Session.set_runtime(session.pid, runtime)
|
||||||
|
|
Loading…
Reference in a new issue