Skip to content

Commit

Permalink
Dockerfile and github workflow for Docker image build and push
Browse files Browse the repository at this point in the history
  • Loading branch information
CastillonMiguel committed Nov 11, 2024
1 parent 19b26dd commit 0bbc6eb
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Create and publish a Docker image

on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches:
- "main"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for base-image
id: meta-base
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name == 'push' }}
platforms: linux/amd64
tags: ${{ steps.meta-base.outputs.tags }}
labels: ${{ steps.meta-base.outputs.labels }}
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# We choose ubuntu 22.04 as our base docker image (linux/amd64)
FROM ghcr.io/fenics/dolfinx/dolfinx:v0.9.0@sha256:61f17eb5de64721e8bbfc06b0e715bd8d0c3b6f8ec37d30f6985016c6ac68472

ENV PYVISTA_JUPYTER_BACKEND="html"

# Requirements for pyvista
RUN apt-get update && apt-get install -y libgl1 libglx-mesa0
RUN apt-get update && apt-get install -y libxrender1
RUN apt-get update && apt-get install -y xvfb
RUN apt-get update && apt-get install -y nodejs

COPY . /repo
WORKDIR /repo

RUN python3 -m pip install vtk

RUN python3 -m pip install jupyter-book
RUN python3 -m pip install jupyter
RUN python3 -m pip install pyvista[all]
RUN python3 -m pip install trame-vuetify
RUN python3 -m pip install ipywidgets

RUN python3 -m pip install .

0 comments on commit 0bbc6eb

Please sign in to comment.