diff --git a/services/backup/Dockerfile.m1 b/services/backup/Dockerfile.m1 new file mode 100644 --- /dev/null +++ b/services/backup/Dockerfile.m1 @@ -0,0 +1,23 @@ +FROM commapp/services-base:1.1.m1 + +RUN apt-get update && \ + apt-get install -y uuid-dev && \ + rm -rf /var/lib/apt/lists/* + +ARG COMM_TEST_SERVICES +ARG COMM_SERVICES_DEV_MODE + +ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES} +ENV COMM_SERVICES_DEV_MODE=${COMM_SERVICES_DEV_MODE} + +WORKDIR /transferred + +COPY native/cpp/CommonCpp/grpc/protos/backup.proto native/cpp/CommonCpp/grpc/protos/blob.proto protos/ +COPY services/lib/cmake-components cmake-components +COPY services/lib/docker/ scripts/ +COPY services/backup/ . +COPY services/lib/src/* src/ + +RUN scripts/build_service.sh + +CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_service.sh; fi diff --git a/services/blob/Dockerfile.m1 b/services/blob/Dockerfile.m1 new file mode 100644 --- /dev/null +++ b/services/blob/Dockerfile.m1 @@ -0,0 +1,23 @@ +FROM commapp/services-base:1.1.m1 + +RUN apt-get update && \ + apt-get install -y uuid-dev && \ + rm -rf /var/lib/apt/lists/* + +ARG COMM_TEST_SERVICES +ARG COMM_SERVICES_DEV_MODE + +ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES} +ENV COMM_SERVICES_DEV_MODE=${COMM_SERVICES_DEV_MODE} + +WORKDIR /transferred + +COPY native/cpp/CommonCpp/grpc/protos/blob.proto protos/blob.proto +COPY services/lib/cmake-components cmake-components +COPY services/lib/docker/ scripts/ +COPY services/blob/ . +COPY services/lib/src/* src/ + +RUN scripts/build_service.sh + +CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_service.sh; fi diff --git a/services/docker-compose.yml b/services/docker-compose.yml --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -8,7 +8,7 @@ - localstack - rabbitmq build: - dockerfile: services/tunnelbroker/Dockerfile + dockerfile: services/tunnelbroker/${COMM_SERVICES_DOCKERFILE} context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} @@ -26,7 +26,7 @@ depends_on: - localstack build: - dockerfile: services/backup/Dockerfile + dockerfile: services/backup/${COMM_SERVICES_DOCKERFILE} context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} @@ -41,7 +41,7 @@ depends_on: - localstack build: - dockerfile: services/blob/Dockerfile + dockerfile: services/blob/${COMM_SERVICES_DOCKERFILE} context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} diff --git a/services/scripts/build_base_image.sh b/services/scripts/build_base_image.sh --- a/services/scripts/build_base_image.sh +++ b/services/scripts/build_base_image.sh @@ -7,5 +7,10 @@ exit 1 fi -tag=${1:-"1.1"} +TAG="1.1" +if [[ $(uname -m) == 'arm64' ]]; then + TAG="$TAG.m1" +fi + +tag=${1:-$TAG} docker build -t commapp/services-base:${tag} base-image diff --git a/services/scripts/run_server_image.sh b/services/scripts/run_server_image.sh --- a/services/scripts/run_server_image.sh +++ b/services/scripts/run_server_image.sh @@ -29,5 +29,10 @@ exit 1 fi -docker-compose build $SERVICE-server -docker-compose up $SERVICE-server +DOCKERFILE="Dockerfile" +if [[ $(uname -m) == 'arm64' ]]; then + DOCKERFILE="Dockerfile.m1" +fi + +COMM_SERVICES_DOCKERFILE=$DOCKERFILE docker-compose build $SERVICE-server +COMM_SERVICES_DOCKERFILE=$DOCKERFILE docker-compose up $SERVICE-server diff --git a/services/tunnelbroker/Dockerfile.m1 b/services/tunnelbroker/Dockerfile.m1 new file mode 100644 --- /dev/null +++ b/services/tunnelbroker/Dockerfile.m1 @@ -0,0 +1,35 @@ +FROM commapp/services-base:1.1 + +ARG MAKE_JOBS=4 +ENV MAKEFLAGS="-j${MAKE_JOBS}" + +WORKDIR /transferred/scripts + +# Install SDKs +COPY services/tunnelbroker/docker/install_amqp_cpp.sh . +RUN ./install_amqp_cpp.sh + +COPY services/tunnelbroker/docker/install_cryptopp.sh . +RUN ./install_cryptopp.sh + +COPY services/tunnelbroker/docker/install_libuv.sh . +RUN ./install_libuv.sh + +ARG COMM_TEST_SERVICES +ARG COMM_SERVICES_DEV_MODE + +ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES} +ENV COMM_SERVICES_DEV_MODE=${COMM_SERVICES_DEV_MODE} + +WORKDIR /transferred + +COPY native/cpp/CommonCpp/grpc/protos/tunnelbroker.proto protos/tunnelbroker.proto +COPY services/lib/cmake-components cmake-components +COPY services/lib/docker/ scripts/ +COPY services/tunnelbroker/docker/* docker/ +COPY services/tunnelbroker/ . +COPY services/lib/src/* src/ + +RUN scripts/build_service.sh + +CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_service.sh; else scripts/run_service.sh; fi