Skip to content

add the build_pyne build-arg into virtualbox_image.yml instead of doc… #9

add the build_pyne build-arg into virtualbox_image.yml instead of doc…

add the build_pyne build-arg into virtualbox_image.yml instead of doc… #9

name: Create VirtualBox disk image from Dockerfile
on:
# allows us to run workflows manually
workflow_dispatch:
release:
types:
- published
push:
paths:
- 'docker/*'
- '.github/workflows/virtualbox_image.yml'
env:
VM_PASSWORD: temppwd
DOCKER_IMAGE_BASENAME: ghcr.io/${{ github.repository_owner }}/pyne_ubuntu_22.04_py3
DOCKER_IMAGE_TAG: :refs_heads_${{ github.ref_name }}-bk0
jobs:
pyne_image_build:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.output_tag.outputs.image_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build PyNE docker image
uses: firehed/multistage-docker-build-action@v1
id: build_pyne
with:
repository: ${{ env.DOCKER_IMAGE_BASENAME }}
stages: base_python, moab, dagmc, openmc
server-stage: pyne
quiet: false
tag-latest-on-default: false
dockerfile: docker/ubuntu_22.04-dev.dockerfile
build-args: build_hdf5=hdf5-1_12_0, build_pyne=YES
- id: output_tag
run: |
echo "image_tag=$DOCKER_IMAGE_TAG" >> $GITHUB_OUTPUT
pushing_test_stable_img:
needs: [pyne_image_build]
runs-on: ubuntu-latest
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image to stable img
uses: akhilerm/tag-push-action@v2.1.0
with:
src: ${{ env.DOCKER_IMAGE_BASENAME }}/pyne${{ env.DOCKER_IMAGE_TAG }}
dst: ${{ env.DOCKER_IMAGE_BASENAME }}/pyne:stable
- name: Push Image to latest img
uses: akhilerm/tag-push-action@v2.1.0
with:
src: ${{ env.DOCKER_IMAGE_BASENAME }}/pyne${{ env.DOCKER_IMAGE_TAG }}
dst: ${{ env.DOCKER_IMAGE_BASENAME }}/pyne:latest
virtualbox_image_build:
needs: [pushing_test_stable_img]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build VirtualBox image using d2vm
run: |
sudo apt-get update
sudo apt-get install -y --fix-missing \
util-linux \
udev \
parted \
e2fsprogs \
mount \
tar \
extlinux \
qemu-utils
curl -sL "https://github.com/linka-cloud/d2vm/releases/download/v0.2.0/d2vm_v0.2.0_linux_amd64.tar.gz" | tar -xvz d2vm
sudo mv d2vm /usr/local/bin/
sudo d2vm convert ghcr.io/${{ github.actor }}/pyne_ubuntu_22.04_py3/pyne:latest -p ${{ env.VM_PASSWORD }} -o pyne.vdi
- name: Upload VirtualBox image as artifact
uses: actions/upload-artifact@v3
with:
name: virtualbox_image
path: pyne.vdi