Skip to content

Commit

Permalink
docs: dev container for GH codespaces (#1070)
Browse files Browse the repository at this point in the history
* added simple devcontainer setup

* added simple devcontainer setup, fixes #1052

* added simple devcontainer setup, fixes #1052

* added info about codespaces

* formatting

* formatting

* adapted labels and pkgs.

* added workflow to build base image for condespaces

* adapted devcontainer to use base image

* adapted image name

* installing git

* bumped python version

* using root to install apt pkgs

* running only on releases

* adapting name of codespace

Co-authored-by: Jan <[email protected]>

* added ref. link for Codespaces

* removed trailing whitespace

* Applying suggestions from code review

Co-authored-by: Jan <[email protected]>

* renaming pipeline

---------

Co-authored-by: Jan <[email protected]>
Co-authored-by: Jan Boelts <[email protected]>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent ea1cc20 commit a7e65c5
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM jupyter/base-notebook:python-3.11
LABEL org.opencontainers.image.source="https://github.com/sbi-dev/sbi"
LABEL org.opencontainers.image.description="Image for a Docker Devcontainer for the sbi toolbox."
LABEL org.opencontainers.image.licenses="Apache-2.0"

# Install latest release of sbi instead of current main branch this is
# intenationally as the codespace shall facilitate as an easy access for new
# users to experience the toolkit rather than a development environment.
USER root

RUN apt update && apt install -y git

RUN pip install \
sbi \
ipywidgets
23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Codespace for the SBI Toolkit.",

"image": "ghcr.io/sbi-dev/sbi/base-image-codespaces:latest",

"customizations": {
"vscode": {
"terminal": {
"integrated.shell.linux": "/bin/bash"
},
"extensions": [
"GitHub.copilot",
"ms-python.python",
"ms-toolsai.jupyter",
"stkb.rewrap",
"streetsidesoftware.code-spell-checker"
]
}
},

// open the default port for jupyter notebook
"forwardPorts": [8888]
}
35 changes: 35 additions & 0 deletions .github/workflows/build_codespace_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docker Image for sbi toolkit

on:
release:
types: [published]

jobs:
build_devcontainer_base:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: .devcontainer/Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository }}/base-image-codespaces:latest
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ print(posterior)

## Tutorials

For first-time users: You can now head over to the tutorials and get going with [Getting Started](https://sbi-dev.github.io/sbi/tutorial/00_getting_started/).
If you're new to `sbi`, we recommend starting with our [Getting
Started](https://sbi-dev.github.io/sbi/tutorial/00_getting_started/) tutorial.

You can easily access and run these tutorials by opening a
[Codespace](https://docs.github.com/en/codespaces/overview) on this repo. To do
so, click on the green "Code" button and select "Open with Codespaces". This will
provide you with a fully functional environment where you can run the tutorials as
Jupyter notebooks.

## Inference Algorithms

Expand Down

0 comments on commit a7e65c5

Please sign in to comment.