blob: a4ef63032600086c6c6db91721f3d836f0cf50ea (
plain)
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
|
#!/bin/bash
# Do not call directly. Meant to be called from CI build script.
pushd {{ pillar["customer_api_server"]["build_dir"] }} 2>/dev/null
echo "Creating tmp directory"
rm -rf tmp
mkdir tmp
rm -f docker-start.tar.xz
echo "Populating with custom files"
rsync -aq data/ tmp/
echo "Repackaging into .xz file"
tar Jcvf docker-start.tar.xz -C tmp/ .
echo "Deleting existing docker container"
docker stop {{ pillar["customer_api_server"]["container_name"] }}_{{ pillar["customer_api_server"]["branch"] }}
docker container prune -f
docker rmi -f {{ pillar["customer_api_server"]["image_name"] }}_{{ pillar["customer_api_server"]["branch"] }}
echo "Building docker Ubuntu image"
docker build -t {{ pillar["customer_api_server"]["image_name"] }}_{{ pillar["customer_api_server"]["branch"] }} .
echo "Push docker image to the registry"
docker tag {{ pillar["customer_api_server"]["image_name"] }}_{{ pillar["customer_api_server"]["branch"] }} {{ pillar["registry"]["url"] }}/{{ pillar["customer_api_server"]["image_name"] }}_{{ pillar["customer_api_server"]["branch"] }}
docker push {{ pillar["registry"]["url"] }}/{{ pillar["customer_api_server"]["image_name"] }}_{{ pillar["customer_api_server"]["branch"] }}
echo "Cleaning up"
rm -rf tmp
rm -f docker-start.tar.xz
popd 2>/dev/null
exit 0
|