Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Update how the codebase is structured #5

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 28 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,32 @@ 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
build-args: |
CAUSTICS_VERSION=${{ matrix.CAUSTICS_VERSION }}
CUDA_VERSION=${{ matrix.CUDA_VERSION }}

- 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
build-args: |
CAUSTICS_VERSION=${{ matrix.CAUSTICS_VERSION }}
CUDA_VERSION=${{ matrix.CUDA_VERSION }}
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.

Loading