diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1f08a25 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: Earthly +all + +on: + push: + branches: [ main ] + tags: [ v** ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + image: [python-jupyter, python-code] + env: + FORCE_COLOR: 1 + steps: + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + root-reserve-mb: 512 + swap-size-mb: 1024 + remove-dotnet: 'true' + remove-android: 'true' + remove-codeql: 'true' + remove-haskell: 'true' + overprovision-lvm: 'true' + - uses: earthly/actions-setup@v1 + with: + version: v0.8.0 + - uses: actions/checkout@v4 + - name: Login to GitHub Packages + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get branch names. + id: branch-names + uses: tj-actions/branch-names@v8 + - name: Run build + run: earthly --ci --push +${{ matrix.image }} --REGISTRY ghcr.io/thm-mni-ii/ml-docker-images --VERSION ${{ github.ref_name }} diff --git a/Earthfile b/Earthfile new file mode 100644 index 0000000..442387b --- /dev/null +++ b/Earthfile @@ -0,0 +1,31 @@ +VERSION 0.8 + +IMPORT ./language/python AS python +IMPORT ./language/julia AS julia +IMPORT ./frontend/jupyter AS jupyter +IMPORT ./frontend/code AS code + +ARG --required --global REGISTRY +ARG --required --global VERSION + +common: + FROM mambaorg/micromamba:1.5.8 + RUN micromamba install -n base -c conda-forge -y htop nvtop + +all: + BUILD +python-jupyter + BUILD +python-code + +python: + FROM +common + DO python+SETUP + +python-jupyter: + FROM +python + DO jupyter+SETUP + SAVE IMAGE --push $REGISTRY/python-jupyter:$VERSION + +python-code: + FROM +python + DO code+SETUP + SAVE IMAGE --push $REGISTRY/python-code:$VERSION diff --git a/frontend/code/Earthfile b/frontend/code/Earthfile new file mode 100644 index 0000000..50a27ca --- /dev/null +++ b/frontend/code/Earthfile @@ -0,0 +1,10 @@ +VERSION 0.8 + +SETUP: + FUNCTION + RUN micromamba install -n base -c conda-forge -y code-server ipykernel ipywidgets + RUN micromamba -n base run code-server \ + --install-extension ms-toolsai.jupyter \ + --install-extension equinusocio.vsc-material-theme \ + --install-extension equinusocio.vsc-material-theme-icons \ + --install-extension ms-python.python diff --git a/frontend/jupyter/Earthfile b/frontend/jupyter/Earthfile new file mode 100644 index 0000000..0f229b2 --- /dev/null +++ b/frontend/jupyter/Earthfile @@ -0,0 +1,5 @@ +VERSION 0.8 + +SETUP: + FUNCTION + RUN micromamba install -n base -c conda-forge -y jupyterlab ipykernel ipywidgets diff --git a/language/python/Earthfile b/language/python/Earthfile new file mode 100644 index 0000000..1e05812 --- /dev/null +++ b/language/python/Earthfile @@ -0,0 +1,9 @@ +VERSION 0.8 + +SETUP: + FUNCTION + RUN micromamba install -n base -c pytorch -c nvidia -c conda-forge -y \ + python pytorch torchvision torchaudio pytorch-cuda=11.8 \ + lightning torchinfo tensorboard tensorboardx \ + transformers diffusers datasets accelerate evaluate optimum \ + matplotlib seaborn plotly \