generated from precimed/container_template
-
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.
* Push singularity .sif files to ghcr.io with tags Fixes #12 * rename action * name * readme updates
- Loading branch information
Showing
5 changed files
with
144 additions
and
46 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,99 @@ | ||
name: container build push | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/ldpred2 | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=sha | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to GitHub Container Registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: "{{defaultContext}}:docker" | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
file: | ||
./dockerfiles/ldpred2/Dockerfile | ||
platforms: linux/amd64 | ||
|
||
build-push-singularity-container: | ||
needs: docker | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
container: | ||
image: quay.io/singularity/singularity:v4.1.0 | ||
options: --privileged | ||
name: Pull-push Singularity Container | ||
steps: | ||
- name: Check out code for the container builds | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
apk add --no-cache curl | ||
VERSION="1.1.0" | ||
curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz" | ||
mkdir -p oras-install/ | ||
tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/ | ||
sudo mv oras-install/oras /usr/local/bin/ | ||
rm -rf oras_${VERSION}_*.tar.gz oras-install/ | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/ldpred2 | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=ref,event=branch | ||
type=sha | ||
- name: Pull and push Singularity container | ||
run: | | ||
tags="${{ steps.meta.outputs.tags }}" | ||
tags_array= | ||
old_ifs="$IFS" | ||
IFS=$'\n' | ||
for tag in $tags; do | ||
tags_array="$tags_array $tag" | ||
done | ||
IFS="$old_ifs" | ||
echo ${{ secrets.GITHUB_TOKEN }} | oras login --username ${{ github.repository_owner }} --password-stdin ghcr.io | ||
for tag in $tags_array; do | ||
echo "processing tag: $tag" | ||
singularity pull ldpred2.sif docker://"$tag" | ||
oras push "$tag" --artifact-type application/vnd.acme.rocket.config ldpred2.sif | ||
rm ldpred2.sif | ||
done | ||
shell: sh |
This file was deleted.
Oops, something went wrong.
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
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
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