-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added buildah script and github workflow
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build and Push Container Image | ||
|
||
on: | ||
push: | ||
tags: ['v*'] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get the latest tag | ||
id: get_tag | ||
run: echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> "$GITHUB_ENV" | ||
|
||
- name: Authenticate to ghcr | ||
run: echo ${{ secrets.GHCR_PAT }} | buildah login --username cjtitus --password-stdin ghcr.io | ||
|
||
- name: Run build script | ||
run: bash buildah_scripts/build.sh | ||
|
||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository }} | ||
# Make sure IMAGE_ID is lowercase for buildah | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
echo $IMAGE_ID | ||
echo "buildah push sst_gui:latest $IMAGE_ID:latest" | ||
buildah push --creds ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} sst_gui:latest $IMAGE_ID:latest | ||
echo "buildah push sst_gui:latest $IMAGE_ID:$LATEST_TAG" | ||
buildah push sst_gui:latest $IMAGE_ID:$LATEST_TAG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/bash | ||
set -e | ||
set -o xtrace | ||
|
||
|
||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
host_package_dir=$(dirname "$script_dir")/src | ||
container_package_dir=/usr/local/src/sst_gui | ||
|
||
version="0.0.1" | ||
|
||
# Check if bluesky:latest image is available locally | ||
if [[ "$(buildah images -q sst:latest)" == "" ]]; then | ||
echo "Image not found locally. Pulling from ghcr.io/nsls-ii-sst..." | ||
buildah pull ghcr.io/nsls-ii-sst/sst:latest | ||
fi | ||
|
||
container=$(buildah from sst) | ||
buildah run $container -- dnf -y install qt5-qtbase-devel | ||
buildah run $container -- conda install -y pyqt | ||
buildah run $container -- pip3 install bluesky_queueserver_api | ||
|
||
buildah copy $container $host_package_dir $container_package_dir | ||
buildah run --workingdir $container_package_dir $container -- pip3 install . | ||
|
||
#buildah config --cmd "sst-gui --config /usr/local/src/sst_gui/sst_gui/test_config.yaml" $container | ||
|
||
buildah unmount $container | ||
|
||
buildah commit $container sst_gui:$version | ||
buildah commit $container sst_gui:latest | ||
|
||
buildah rm $container |