Skip to content

Commit 1a27019

Browse files
committed
added build images script and changes to digest api image
1 parent 8d81b10 commit 1a27019

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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

infra/digest_api/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY . /usr/src/api/id_manager/
66
COPY digest_service /usr/src/api/id_manager
77

88
RUN pip install --upgrade pip
9-
RUN pip install -r requirements.txt
10-
RUN pip install -r project_requirements.txt
9+
RUN pip install -r digest_service/requirements.txt
10+
RUN pip install -r digest_service/project_requirements.txt
1111

1212
ENTRYPOINT uvicorn --host 0.0.0.0 --port 8000 ted_sws.notice_transformer.entrypoints.api.digest_service.main:app

0 commit comments

Comments
 (0)