-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·32 lines (25 loc) · 930 Bytes
/
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
#!/bin/bash
set -e
echo "Remove old database containers"
docker rm -f geonames-postgis || true
docker rmi geonames-postgis || true
echo "Bring data base up and store unclean data"
docker pull postgis/postgis:14-3.2-alpine
docker build --no-cache --tag geonames-postgis -f Dockerfile.db .
docker run --name geonames-postgis --name geonames-postgis \
-v $(pwd)/init.db:/docker-entrypoint-initdb.d \
-v $(pwd)/var/geonames_extract:/geonames_extract \
-p 5432:5432 \
-e POSTGRES_PASSWORD=geonames -e POSTGRES_USER=geonames -e POSTGRES_DB=geonames \
-d geonames-postgis
echo "Building process application"
go mod tidy
go build -o geodata
echo "Running process application"
./geodata
echo "Stop container"
docker stop geonames-postgis
echo "Copy container files"
docker cp geonames-postgis:/var/lib/postgresql/data var/data
echo "Make new image from stored data"
docker build -f Dockerfile -t aasaam/geonames-postgis .