forked from conda-forge/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-image-and-push.sh
executable file
·45 lines (36 loc) · 1.36 KB
/
build-image-and-push.sh
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
#!/bin/bash
set -e
if [ "$#" -ne 1 ]; then
1>&2 echo "Usage:"
1>&2 echo ""
1>&2 echo " $0 linux-anvil-comp7"
1>&2 echo " $0 flyem-build"
exit 1
fi
##
## Note:
## Instead of building linux-anvil-comp7 from scratch,
## we can just copy the one from conda-forge:
##
## docker pull condaforge/linux-anvil-comp7:latest
## docker tag condaforge/linux-anvil-comp7:latest flyem/linux-anvil-comp7:latest
## docker push flyem/linux-anvil-comp7:latest
##
## OR:
## docker pull condaforge/linux-anvil-cos7-x86_64:latest
## docker tag condaforge/linux-anvil-cos7-x86_64:latest flyem/linux-anvil-cos7-x86_64:latest
## docker push flyem/linux-anvil-cos7-x86_64:latest
##
## That way, we keep our own copy of the container (we're not subject to changes conda-forge makes),
## but we don't have to build it ourselves.
##
TAG=$(git describe)
DOCKERHUB_ACCOUNT=flyem
CENTOS_VER=7
IMAGE_NAME=$1
docker build -t ${DOCKERHUB_ACCOUNT}/${IMAGE_NAME}:${TAG} --build-arg CENTOS_VER=${CENTOS_VER} -f ${IMAGE_NAME}/Dockerfile .
# Create an additional tag 'latest'
docker tag ${DOCKERHUB_ACCOUNT}/${IMAGE_NAME}:${TAG} ${DOCKERHUB_ACCOUNT}/${IMAGE_NAME}:latest
# Push the container twice, using both tags (versioned and 'latest')
docker push ${DOCKERHUB_ACCOUNT}/${IMAGE_NAME}:${TAG}
docker push ${DOCKERHUB_ACCOUNT}/${IMAGE_NAME}:latest