Skip to content

Commit

Permalink
refactor: Update how the codebase is structured
Browse files Browse the repository at this point in the history
  • Loading branch information
lsetiawan committed Feb 13, 2024
1 parent bdfc3bf commit de93ef4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 84 deletions.
39 changes: 22 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Any commit to master branch re-builds images, re-runs tests, and pushes SHA tags to DockerHub
name: Build
on:
pull_request:
push:
branches:
- main
Expand All @@ -14,6 +15,7 @@ env:
DOCKER_ORG: ${{ github.repository_owner }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
PROJECT_NAME: caustics

jobs:
build-images:
Expand All @@ -24,17 +26,12 @@ jobs:
strategy:
fail-fast: false
matrix:
IMAGE: [base]
CAUSTICS_VERSION: ["dev", "0.7.0"]
CUDA_VERSION: ["11.8.0"]
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Get date tag
id: get_date
run: |
DATE_TAG="$( date -u '+%Y.%m.%d' )"
echo "date_tag=$DATE_TAG" >> $GITHUB_OUTPUT
- name: Get registry and org
id: registry_org
run: |
Expand All @@ -54,11 +51,9 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ steps.registry_org.outputs.image_base }}/${{ matrix.IMAGE }}
images: ${{ steps.registry_org.outputs.image_base }}/${{ env.PROJECT_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest
type=raw,value=${{ steps.get_date.outputs.date_tag }}
type=raw,value=${{ matrix.CAUSTICS_VERSION }}-cuda-${{ matrix.CUDA_VERSION }}
- name: Log in to registry
uses: docker/login-action@v2
Expand All @@ -69,16 +64,26 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4

- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: ${{ matrix.IMAGE }}
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

- name: Inspect Image
run: |
docker run ${{ steps.registry_org.outputs.image_base }}/${{ matrix.IMAGE }}:latest micromamba list
docker run ${{ steps.registry_org.outputs.image_base }}/${{ env.PROJECT_NAME }}:${{ matrix.CAUSTICS_VERSION }}-cuda-${{ matrix.CUDA_VERSION }} micromamba list
docker images ls
- name: Build and push Docker image
uses: docker/build-push-action@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
18 changes: 11 additions & 7 deletions base/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM mambaorg/micromamba:focal-cuda-11.8.0
ARG CUDA_VERSION=11.8.0
FROM mambaorg/micromamba:focal-cuda-${CUDA_VERSION}

ARG CAUSTICS_BRANCH=dev
ARG CAUSTICS_VERSION=0.7.0

# Tell apt-get to not block installs by asking for interactive human input
ENV DEBIAN_FRONTEND=noninteractive \
Expand Down Expand Up @@ -39,8 +40,11 @@ RUN micromamba install --name base --yes --file /tmp/conda-linux-64.lock \
ARG MAMBA_DOCKERFILE_ACTIVATE=1

# Install caustics from a branch for now
RUN echo "Caustics branch: ${CAUSTICS_BRANCH}"
ENV CAUSTICS_REPO="git+https://github.com/Ciela-Institute/caustics.git@${CAUSTICS_BRANCH}"

RUN echo "Installing caustics" \
&& pip install --no-cache ${CAUSTICS_REPO}
ENV CAUSTICS_REPO="git+https://github.com/Ciela-Institute/caustics.git@${CAUSTICS_VERSION}"
RUN echo "Installing caustics ..." \
; if [ "${CAUSTICS_VERSION}" == "dev" ]; then \
echo "Installing from github branch: ${CAUSTICS_VERSION}" \
&& pip install --no-cache ${CAUSTICS_REPO} \
; else echo "Installing from production distribution version: ${CAUSTICS_VERSION}" ; \
pip install caustics==${CAUSTICS_VERSION} \
; fi
File renamed without changes.
File renamed without changes.
60 changes: 0 additions & 60 deletions nvidia/Dockerfile

This file was deleted.

0 comments on commit de93ef4

Please sign in to comment.