-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (49 loc) · 1.58 KB
/
docker.yml
File metadata and controls
60 lines (49 loc) · 1.58 KB
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
name: Docker
on: [push, pull_request]
env:
ENVIRONMENT: test
VERBOSE: true
TERM: xterm
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY: ghcr.io
DOCKER_USERNAME: ${{ github.actor }}
PROJECT: ${{ github.event.repository.name }}
jobs:
build-docker:
name: Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Show ref
run: |
echo "Checking out $GITHUB_REF..."
- name: Login to Registry
run: |
echo $GITHUB_TOKEN | docker login $DOCKER_REGISTRY -u $DOCKER_USERNAME --password-stdin
- name: Pull latest image
run: |
make docker-pull
- name: Build Image
run: |
make docker-build
- name: Push Image
run: |
make docker-push
build-singularity:
needs:
- build-docker
name: Build Singularity
runs-on: ubuntu-latest
container:
image: quay.io/singularity/docker2singularity
options: --privileged
steps:
- name: Build SIF File
run: |
DOCKER_IMAGE="${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${PROJECT}"
SINGULARITY_IMAGE="$(echo -n ${DOCKER_IMAGE} | tr -c '[:alnum:].' '-').sif"
docker-entrypoint.sh /docker2singularity.sh \
--name ${SINGULARITY_IMAGE} \
${DOCKER_IMAGE}
echo ${GITHUB_TOKEN} | singularity remote login -u ${DOCKER_USERNAME} --password-stdin oras://${DOCKER_REGISTRY}
singularity push /output/${SINGULARITY_IMAGE} oras://${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${PROJECT}:singularity