|
| 1 | +MONGO_IMAGE=docker.io/mongo:5.0.10 |
| 2 | +FUSEKI_IMAGE=docker.io/secoresearch/fuseki:4.5.0 |
| 3 | +METABASE_IMAGE=docker.io/metabase/metabase:v0.43.4 |
| 4 | +AIRFLOW_POSTGRES_IMAGE=docker.io/postgres:14.4-alpine |
| 5 | +REDIS_IMAGE=docker.io/redis:7.0.4-alpine3.16 |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +IMAGES_TO_BE_BUILD=(airflow digest_api metabase_postgres) |
| 10 | +IMAGES_FROM_DOCKER_HUB=(fuseki airflow_postgres metabase mongo redis) |
| 11 | +source .env |
| 12 | +export $(cat .env | xargs) |
| 13 | +cd ../../ |
| 14 | +cp requirements.txt ./infra/airflow/ |
| 15 | +cp requirements.txt ./infra/digest_api/digest_service/project_requirements.txt |
| 16 | +cp -r ted_sws ./infra/digest_api/ |
| 17 | +make create-env-digest-api |
| 18 | +cd infra/aws |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +build_image_from_source_code(){ |
| 23 | + echo "Building image for $1" |
| 24 | + IMAGE_NAME=$1 |
| 25 | + if [ "$IMAGE_NAME" = "metabase_postgres" ]; then |
| 26 | + IMAGE_NAME=metabase |
| 27 | + podman build -t $IMAGE_NAME-postgres ../$IMAGE_NAME/ --label=$IMAGE_NAME-postgres-image |
| 28 | + else |
| 29 | + podman build -t $IMAGE_NAME ../$IMAGE_NAME/ --label=$IMAGE_NAME-image |
| 30 | + fi |
| 31 | + |
| 32 | +} |
| 33 | + |
| 34 | +get_built_image_from_docker_hub(){ |
| 35 | + echo "Getting image for $1" |
| 36 | + IMAGE_NAME=$1 |
| 37 | + REPO_NAME=${IMAGE_NAME^^} |
| 38 | + IMAGE_TO_PULL=${REPO_NAME}_IMAGE |
| 39 | + podman pull ${!IMAGE_TO_PULL} |
| 40 | +} |
| 41 | + |
| 42 | +for IMAGE_NAME in "${IMAGES_FROM_DOCKER_HUB[@]}" |
| 43 | +do |
| 44 | + get_built_image_from_docker_hub $IMAGE_NAME |
| 45 | +done |
| 46 | + |
| 47 | +for IMAGE_NAME in "${IMAGES_TO_BE_BUILD[@]}" |
| 48 | +do |
| 49 | + build_image_from_source_code $IMAGE_NAME |
| 50 | +done |
0 commit comments