forked from Azure-App-Service/php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·47 lines (38 loc) · 2.11 KB
/
build.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
46
47
#!/usr/bin/env bash
# arg1: name of destination dockerhub
# arg2: dockerhub username
# arg3: dockerhub password
set -x -e
buildnumber=${4-$(date -u +"%y%m%d%H%M")}
docker login -u "$2" -p "$3"
# build base images
docker build -q -t "$1"/php:5.6-apache_"$buildnumber" 5.6-apache
docker build -q -t "$1"/php:7.0-apache_"$buildnumber" 7.0-apache
docker build -q -t "$1"/php:7.2-apache_"$buildnumber" -t 7.2-apache
docker build -q -t "$1"/php:7.3-apache_"$buildnumber" -t "$1"/php:latest_"$buildnumber" 7.3-apache
docker tag "$1"/php:latest_"$buildnumber" "$1"/php:latest
docker push "$1"/php:5.6-apache_"$buildnumber"
docker push "$1"/php:7.0-apache_"$buildnumber"
docker push "$1"/php:7.2-apache_"$buildnumber"
docker push "$1"/php:7.3-apache_"$buildnumber"
docker push "$1"/php:latest_"$buildnumber"
docker push "$1"/php:latest
# xdebug depends on base images
# generate dockerfile for xdebug
sed -e s/reponame/"$1"/g -e s/buildnumber/"$buildnumber"/g 5.6-apache-xdebug/Dockerfile.template > 5.6-apache-xdebug/Dockerfile
sed -e s/reponame/"$1"/g -e s/buildnumber/"$buildnumber"/g 7.0-apache-xdebug/Dockerfile.template > 7.0-apache-xdebug/Dockerfile
sed -e s/reponame/"$1"/g -e s/buildnumber/"$buildnumber"/g 7.2-apache-xdebug/Dockerfile.template > 7.2-apache-xdebug/Dockerfile
sed -e s/reponame/"$1"/g -e s/buildnumber/"$buildnumber"/g 7.3-apache-xdebug/Dockerfile.template > 7.3-apache-xdebug/Dockerfile
# build xdebug images
docker build -q -t "$1"/5.6-apache-xdebug_"$buildnumber" 5.6-apache-xdebug
docker build -q -t "$1"/7.0-apache-xdebug_"$buildnumber" 7.0-apache-xdebug
docker build -q -t "$1"/7.2-apache-xdebug_"$buildnumber" 7.2-apache-xdebug
docker build -q -t "$1"/7.3-apache-xdebug_"$buildnumber" -t "$1"/php:latest-xdebug_"$buildnumber" 7.3-apache-xdebug
docker tag "$1"/php:latest-xdebug_"$buildnumber" "$1"/php:latest-xdebug
docker push "$1"/php:5.6-apache-xdebug_"$buildnumber"
docker push "$1"/php:7.0-apache-xdebug_"$buildnumber"
docker push "$1"/php:7.2-apache-xdebug_"$buildnumber"
docker push "$1"/php:7.3-apache-xdebug_"$buildnumber"
docker push "$1"/php:latest-xdebug_"$buildnumber"
docker push "$1"/php:latest-xdebug
docker logout