Skip to content

Commit

Permalink
refactor image builds and add cuda variant
Browse files Browse the repository at this point in the history
  • Loading branch information
jandrej committed Nov 21, 2023
1 parent 5fd0278 commit 4815ee5
Show file tree
Hide file tree
Showing 7 changed files with 1,213 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build developer image
name: Build and push images

on:
push:
Expand All @@ -9,7 +9,7 @@ on:
env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}/developer
IMAGE_NAME_BASE: ${{ github.repository }}

jobs:

Expand All @@ -29,8 +29,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build docker image
run: docker build --build-arg njobs=2 --file developer/Dockerfile --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest .
- name: build base image
run: docker-compose build base ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/base:latest .

- name: push docker image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: push base image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/base:latest

- name: build cpu image
run: docker-compose build cpu ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cpu:latest .

- name: push cpu image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cpu:latest
28 changes: 28 additions & 0 deletions base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:22.04

ARG num_jobs

RUN apt-get update && apt-get install -y \
curl git git-lfs clang clang-tools clangd cmake autoconf \
automake gdb git libffi-dev zlib1g-dev python3-pip \
libssl-dev xz-utils pkgconf gfortran openmpi-bin libopenmpi-dev \
wget libarchive-tools htop

RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 && \
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100

ENV OMPI_CC=clang
ENV OMPI_CXX=clang++
ENV LD_LIBRARY_PATH=/usr/local/lib

WORKDIR /opt/archives

# metis
RUN curl -L https://github.com/mfem/tpls/blob/gh-pages/metis-5.1.0.tar.gz?raw=true > /opt/archives/metis-5.1.0.tgz
RUN tar xzf metis-5.1.0.tgz && cd metis-5.1.0 && \
make config shared=1 cc=mpicc prefix=/usr/local && make -j ${num_jobs} && make install

RUN useradd --create-home --shell /bin/bash euler

USER euler
WORKDIR /home/euler
23 changes: 23 additions & 0 deletions cpu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM mfem/containers/base

ARG num_jobs
ARG hypre_version

USER root

WORKDIR /opt/archives

# hypre
RUN curl -L https://github.com/hypre-space/hypre/archive/refs/tags/v${hypre_version}.tar.gz > /opt/archives/hypre-v${hypre_version}.tar.gz
RUN tar xzf hypre-v${hypre_version}.tar.gz && cd hypre-${hypre_version}/src && \
./configure --prefix /usr/local --enable-shared --disable-static && \
make -j ${num_jobs} && make install

USER euler
WORKDIR /home/euler

# MFEM repo checkout
RUN git clone --depth=1 https://github.com/mfem/mfem.git mfem
COPY --chown=euler:euler user.mk mfem/config/user.mk
# Run config/make s.t. first use is a bit quicker
# RUN cd mfem && make config && make -j ${num_jobs} && cd examples && make ex1 && make ex1p
Loading

0 comments on commit 4815ee5

Please sign in to comment.