Skip to content

Commit

Permalink
feat: add python image
Browse files Browse the repository at this point in the history
  • Loading branch information
Zitrone44 committed Apr 11, 2024
0 parents commit 9abf05a
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 }}
31 changes: 31 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions frontend/code/Earthfile
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions frontend/jupyter/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VERSION 0.8

SETUP:
FUNCTION
RUN micromamba install -n base -c conda-forge -y jupyterlab ipykernel ipywidgets
9 changes: 9 additions & 0 deletions language/python/Earthfile
Original file line number Diff line number Diff line change
@@ -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 \

0 comments on commit 9abf05a

Please sign in to comment.