-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add container build/push actions (#260)
* `singularity`: push built container to https://ghcr.io Fixes #256 * bump apt package versions * trigger on PR * build gwas container * trigger build * trigger on any change * build python3 and r containers * trigger on reopened PR * bump libssl-dev version * don't set GITHUB_TOKEN * add GITHUB_TOKEN to Dockerfile ENV * secrets * bump action version * no github_token file? * bump git version * lowercase * GITHUB_PAT * test sleep * something else * secrets * libgomp1 version up; redundant install removed * expose to env, fixes * `singularity`: push built container to https://ghcr.io Fixes #256 * explicit install of deps from GitHub sources * comma * update INSTALL.md * edits * fixes
- Loading branch information
Showing
20 changed files
with
692 additions
and
45 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,53 @@ | ||
# action to build the gwas Docker image at each commit without pushing it | ||
name: build gwas Docker image | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
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 }}/containers | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- | ||
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: False | ||
tags: ${{ steps.meta.outputs.tags }} | ||
file: | ||
./dockerfiles/gwas/Dockerfile | ||
platforms: linux/amd64 |
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,53 @@ | ||
# action to build the hello Docker image at each commit without pushing it | ||
name: build hello Docker image | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
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 }}/containers | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- | ||
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: False | ||
tags: ${{ steps.meta.outputs.tags }} | ||
file: | ||
./dockerfiles/hello/Dockerfile | ||
platforms: linux/amd64 |
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,84 @@ | ||
# action to build and push the gwas Docker and Singularity image at each tag (for release) | ||
name: container build push | ||
|
||
on: | ||
push: | ||
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 }}/containers | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- | ||
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/gwas/Dockerfile | ||
platforms: linux/amd64 | ||
|
||
build-apptainer-container: | ||
needs: docker | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
name: Build Apptainer Container | ||
steps: | ||
- name: Check out code for the container builds | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/gwas | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=ref,event=branch | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Build and push Apptainer container | ||
run: | | ||
tags="${{ steps.meta.outputs.tags }}" | ||
csv_tags=$(printf "%s\n" "$tags" | awk -F: 'NR==1{printf "%s,", $0; next} {printf "%s,", $NF}' | sed 's/,$//') | ||
IFS= read -r first_tag <<EOF | ||
$tags | ||
EOF | ||
push_tags="$(printf $csv_tags | sed -e "s/gwas/gwas_sif/g")" | ||
echo ${{ secrets.GITHUB_TOKEN }} | oras login --username ${{ github.repository_owner }} --password-stdin ghcr.io | ||
docker pull kaczmarj/apptainer:latest | ||
docker run --rm --privileged -v $(pwd):/work kaczmarj/apptainer build gwas.sif docker://"$first_tag" | ||
oras push "$push_tags" --artifact-type application/vnd.acme.rocket.config gwas.sif | ||
rm gwas.sif | ||
shell: sh |
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,84 @@ | ||
# action to build and push the hello Docker and Singularity image at each tag (for release) | ||
name: container build push | ||
|
||
on: | ||
push: | ||
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 }}/containers | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- | ||
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/hello/Dockerfile | ||
platforms: linux/amd64 | ||
|
||
build-apptainer-container: | ||
needs: docker | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
name: Build Apptainer Container | ||
steps: | ||
- name: Check out code for the container builds | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/hello | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=ref,event=branch | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Build and push Apptainer container | ||
run: | | ||
tags="${{ steps.meta.outputs.tags }}" | ||
csv_tags=$(printf "%s\n" "$tags" | awk -F: 'NR==1{printf "%s,", $0; next} {printf "%s,", $NF}' | sed 's/,$//') | ||
IFS= read -r first_tag <<EOF | ||
$tags | ||
EOF | ||
push_tags="$(printf $csv_tags | sed -e "s/hello/hello_sif/g")" | ||
echo ${{ secrets.GITHUB_TOKEN }} | oras login --username ${{ github.repository_owner }} --password-stdin ghcr.io | ||
docker pull kaczmarj/apptainer:latest | ||
docker run --rm --privileged -v $(pwd):/work kaczmarj/apptainer build hello.sif docker://"$first_tag" | ||
oras push "$push_tags" --artifact-type application/vnd.acme.rocket.config hello.sif | ||
rm hello.sif | ||
shell: sh |
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,84 @@ | ||
# action to build and push the python3 Docker and Singularity image at each tag (for release) | ||
name: container build push | ||
|
||
on: | ||
push: | ||
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 }}/containers | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- | ||
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/python3/Dockerfile | ||
platforms: linux/amd64 | ||
|
||
build-apptainer-container: | ||
needs: docker | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
name: Build Apptainer Container | ||
steps: | ||
- name: Check out code for the container builds | ||
uses: actions/checkout@v4 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/python3 | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=ref,event=branch | ||
type=sha | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Build and push Apptainer container | ||
run: | | ||
tags="${{ steps.meta.outputs.tags }}" | ||
csv_tags=$(printf "%s\n" "$tags" | awk -F: 'NR==1{printf "%s,", $0; next} {printf "%s,", $NF}' | sed 's/,$//') | ||
IFS= read -r first_tag <<EOF | ||
$tags | ||
EOF | ||
push_tags="$(printf $csv_tags | sed -e "s/python3/python3_sif/g")" | ||
echo ${{ secrets.GITHUB_TOKEN }} | oras login --username ${{ github.repository_owner }} --password-stdin ghcr.io | ||
docker pull kaczmarj/apptainer:latest | ||
docker run --rm --privileged -v $(pwd):/work kaczmarj/apptainer build python3.sif docker://"$first_tag" | ||
oras push "$push_tags" --artifact-type application/vnd.acme.rocket.config python3.sif | ||
rm python3.sif | ||
shell: sh |
Oops, something went wrong.