Commit 0c03ffeb authored by Alexander Lercher's avatar Alexander Lercher

Build script from new location

parent f9f8a557
import os
import shutil
import sys
DOCKER_COMPOSE_NAME = "Dockerfile"
PATH = '../src/'
ROOT = '../'
SOURCEPATH = f'{ROOT}src/'
paths = []
for r, _, f in os.walk(PATH):
for r, _, f in os.walk(SOURCEPATH):
for filename in f:
if DOCKER_COMPOSE_NAME == filename:
paths.append(os.path.normpath(r))
command_args = [{'path': path,
'name': str(path).split(os.path.normpath('/'))[-1]}
for path
in paths]
'name': str(path).split(os.path.normpath('/'))[-1]}
for path
in paths]
res_str = []
for command_arg in command_args:
path = command_arg['path']
image_name = f"{command_arg['name']}"
image_name = command_arg['name']
# copy Dockerfile into root dir to have access to modules folder
shutil.copy2(os.path.join(path, DOCKER_COMPOSE_NAME), './')
# build then remove Dockerfile
exit_val = os.system(f"docker image build -t {image_name} .")
os.remove(DOCKER_COMPOSE_NAME)
shutil.copy2(os.path.join(path, DOCKER_COMPOSE_NAME), ROOT)
# build then remove Dockerfile
exit_val = os.system(f"docker image build -t {image_name} {ROOT}")
os.remove(os.path.normpath(ROOT, DOCKER_COMPOSE_NAME))
res_str .append (f"### {image_name} built with exit code {exit_val}")
res_str.append(f"### {image_name} built with exit code {exit_val}")
# os.system(f"docker push {image_name}")
print(f"Found {len(command_args)} images")
for s in res_str:
print(s)
\ No newline at end of file
print(s)
......@@ -13,7 +13,7 @@ EXPOSE 5000
WORKDIR /app
COPY src/data-hub/semantic-linking-microservice/app/ /app/
COPY modules/ /app/
COPY src/modules/ /app/
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
......@@ -14,7 +14,7 @@ EXPOSE 5000
WORKDIR /app
COPY src/rest-gateway/app/ /app/
COPY modules/ /app/
COPY src/modules/ /app/
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
......@@ -15,7 +15,7 @@ EXPOSE 5000
WORKDIR /app
COPY src/transaction-hub-in/trace-retrieval-microservice/app/ /app/
COPY modules/ /app/
COPY src/modules/ /app/
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment