-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from JuliaParallel/mg/ci
Add Docker image for the notebooks
- Loading branch information
Showing
5 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Based on https://docs.github.com/en/actions/publishing-packages/publishing-docker-images | ||
|
||
name: Publish Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ "main" ] | ||
# Publish semver tags as releases. | ||
tags: [ 'v*.*.*' ] | ||
paths: | ||
- '.github/workflows/docker-publish.yml' | ||
- 'Dockerfile' | ||
- 'Manifest.toml' | ||
- 'Project.toml' | ||
- 'julia_cpu_target.sh' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- '.github/workflows/docker-publish.yml' | ||
- 'Dockerfile' | ||
- 'Manifest.toml' | ||
- 'Project.toml' | ||
- 'julia_cpu_target.sh' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
concurrency: | ||
# Skip intermediate builds: always. | ||
# Cancel intermediate builds: always. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-push-image: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Docker is terrible and doesn't like uppercase image names. | ||
- name: Lowercase image name | ||
run: | | ||
IMAGE_NAME=$(echo ${IMAGE_NAME} | tr A-Z a-z) | ||
echo "IMAGE_NAME=${IMAGE_NAME}" >> "${GITHUB_ENV}" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: arm64 | ||
|
||
# Needed to make caching on GHA work: https://stackoverflow.com/a/73884678. | ||
# https://github.com/docker/setup-buildx-action | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Log into the registry except on PRs. | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
# Note: building only for `linux/amd64` takes about 5 minutes, building also for | ||
# `linux/arm64` takes about 40 minutes because QEMU is super slow. If you're | ||
# desperate about build times remove `linux/arm64`, but keep in mind the | ||
# `linux/amd64` image won't work very well on Apple Silicon. | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
# See: https://docs.docker.com/build/ci/github-actions/cache/#github-cache | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM julia:1.11.1 | ||
|
||
# Install git | ||
RUN /bin/sh -c 'export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
&& apt-get install -y git \ | ||
&& apt-get --purge autoremove -y \ | ||
&& apt-get autoclean \ | ||
&& rm -rf /var/lib/apt/lists/*' | ||
|
||
# Docker is awful and doesn't allow conditionally setting environment variables in a decent | ||
# way, so we have to keep an external script and source it every time we need it. | ||
COPY julia_cpu_target.sh /julia_cpu_target.sh | ||
|
||
RUN julia --color=yes -e 'using InteractiveUtils; versioninfo()' | ||
|
||
# Instantiate Julia project | ||
RUN mkdir -p /root/.julia/environments/v1.11 | ||
COPY Project.toml /root/.julia/environments/v1.11/Project.toml | ||
# COPY Manifest.toml /root/.julia/environments/v1.11/Manifest.toml | ||
RUN . /julia_cpu_target.sh && julia --color=yes -e 'using Pkg; Pkg.instantiate(); import Conda; Conda.add("jupyterlab")' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[deps] | ||
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d" | ||
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" | ||
|
||
[compat] | ||
Conda = "1.10" | ||
IJulia = "1.25" | ||
julia = "1.11" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
# Set `JULIA_CPU_TARGET`, to ensure we don't specialise pkgimages to the build | ||
# host CPU. Loosely based on | ||
# https://github.com/JuliaCI/julia-buildkite/blob/ea50eb719242bc3e844227a2ebf54a49d308bafc/utilities/build_envs.sh#L25-L32 | ||
# https://github.com/JuliaCI/julia-buildkite/blob/ea50eb719242bc3e844227a2ebf54a49d308bafc/utilities/build_envs.sh#L58-L69 | ||
if [ "$(arch)" = "x86_64" ]; then | ||
export JULIA_CPU_TARGET='generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' | ||
elif [ "$(arch)" = "aarch64" ]; then | ||
export JULIA_CPU_TARGET='generic;carmel,clone_all;apple-m1,base(1)' | ||
fi |