-
Notifications
You must be signed in to change notification settings - Fork 23
67 lines (54 loc) · 2.3 KB
/
build_deploy_container.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Build and Push Docker and Singularity Images
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: 'Tag for the release'
required: false
default: ''
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
SINGULARITY_LIBRARY_TOKEN: ${{ secrets.SINGULARITY_LIBRARY_TOKEN }}
DOCKER_IMAGE_NAME: opaino/genopred_pipeline
SINGULARITY_IMAGE_NAME: library://opain/genopred
IMAGE_TAG: ${{ github.ref_name }}
DOCKERFILE_PATH: pipeline/misc/docker/Dockerfile
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- name: Set Tag
id: set_tag
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "::set-output name=tag::${{ github.event.release.tag_name }}"
else
echo "::set-output name=tag::${{ github.event.inputs.tag || github.sha }}"
fi
# - name: Set up Docker Buildx
# run: |
# docker buildx build --platform linux/amd64 -f $DOCKERFILE_PATH -t $DOCKER_IMAGE_NAME:latest -t $DOCKER_IMAGE_NAME:${{ steps.set_tag.outputs.tag }} --push .
#
- name: Setup singularity
uses: eWaterCycle/setup-singularity@v7
with:
singularity-version: 3.8.3
- name: Convert Docker Image to Singularity SIF
run: |
docker pull $DOCKER_IMAGE_NAME:latest
singularity build ${GITHUB_WORKSPACE}/image.sif docker-daemon://${DOCKER_IMAGE_NAME}:latest
- name: Login to Singularity Library
run: echo "${{ secrets.SINGULARITY_LIBRARY_TOKEN }}" | singularity remote login --tokenfile -
- name: Push Singularity Image to Singularity Library
run: |
singularity push ${GITHUB_WORKSPACE}/image.sif $SINGULARITY_IMAGE_NAME:latest
singularity push ${GITHUB_WORKSPACE}/image.sif $SINGULARITY_IMAGE_NAME:${{ steps.set_tag.outputs.tag }}