From a0e0057f45f21c3303ac1a99504faaa1aafc3e33 Mon Sep 17 00:00:00 2001 From: Aleksei Lunin <alexey.lunin@vereign.com> Date: Tue, 31 Oct 2023 05:24:38 +0300 Subject: [PATCH] deploy preparation --- apps/dashboard/deployment/ci-cd/Dockerfile | 32 ++++++++++++++++++++++ apps/dashboard/entrypoint.sh | 10 +++++++ package.json | 7 +++-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 apps/dashboard/deployment/ci-cd/Dockerfile create mode 100644 apps/dashboard/entrypoint.sh diff --git a/apps/dashboard/deployment/ci-cd/Dockerfile b/apps/dashboard/deployment/ci-cd/Dockerfile new file mode 100644 index 00000000..fa30ae6b --- /dev/null +++ b/apps/dashboard/deployment/ci-cd/Dockerfile @@ -0,0 +1,32 @@ +FROM nginx:stable-alpine + +# Argument handler +ARG API_TOKEN +ARG JOB_ID + +# Set the working directory +WORKDIR app + +# Set the ENV variables +ENV GITLAB_BASE_URL=https://code.vereign.com/api/v4 +ENV GITLAB_PROJECT_ID=662 +ENV TOKEN=$API_TOKEN +ENV ID=$JOB_ID + +# Download the artifacts from the GitLab API +RUN wget --header "PRIVATE-TOKEN: $TOKEN" -O artifacts.zip "${GITLAB_BASE_URL}/projects/${GITLAB_PROJECT_ID}/jobs/${ID}/artifacts" + +# Unzip the artifacts (if needed) - adjust this command based on your artifact type +RUN unzip -q artifacts.zip && rm artifacts.zip + +# Fix locations +RUN cp ./dist/apps/dashboard/ /usr/share/nginx/html + +# Expose required ports +EXPOSE 80 + +COPY ./dist/apps/dashboard/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Command to run +CMD ["/entrypoint.sh"] diff --git a/apps/dashboard/entrypoint.sh b/apps/dashboard/entrypoint.sh new file mode 100644 index 00000000..4dc84cfd --- /dev/null +++ b/apps/dashboard/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Generate config.js with environment variables +echo "window.HTTP_GATEWAY='$HTTP_GATEWAY'; +window.WS_GATEWAY='$WS_GATEWAY'; +window.BASE_PATH='/'; +" > /usr/share/nginx/html/assets/config.js + +# Start Nginx +exec nginx -g 'daemon off;' diff --git a/package.json b/package.json index 429972ed..33c17105 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "license": "Apache-2.0", "scripts": { - "build:all": "yarn build:agent && yarn build:cm && yarn build:am && yarn build:pm && yarn build:gw", + "build:all": "yarn build:agent && yarn build:cm && yarn build:am && yarn build:pm && yarn build:gw && yarn build:dashboard", "build:agent": "nx run agent:build:development --parallel=3", "build:agent:production": "nx run agent:build:production", "build:cm": "nx run connection-manager:build:development --parallel=3", @@ -14,12 +14,15 @@ "build:pm:production": "nx run proof-manager:build:production", "build:gw": "nx run gateway:build:development --parallel=3", "build:gw:production": "nx run gateway:build:production", - "serve:all": "concurrently \"yarn serve:agent\" \"yarn serve:cm\" \"yarn serve:am\" \"yarn serve:pm\" \"yarn serve:gw\"", + "build:dashboard": "nx run dashboard:build:development --parallel=3", + "build:dashboard:production": "nx run dashboard:build:production", + "serve:all": "concurrently \"yarn serve:agent\" \"yarn serve:cm\" \"yarn serve:am\" \"yarn serve:pm\" \"yarn serve:gw\" \"yarn serve:dashboard\"", "serve:agent": "nx run agent:serve:development", "serve:cm": "nx run connection-manager:serve:development", "serve:am": "nx run attestation-manager:serve:development", "serve:pm": "nx run proof-manager:serve:development", "serve:gw": "nx run gateway:serve:development", + "serve:dashboard": "nx run dashboard:serve:development", "infra": "cd compose && docker-compose --profile issuer --profile holder up -d --build", "infra:down": "cd compose && docker-compose --profile issuer --profile holder down", "infra:status": "cd compose && docker-compose ps -a", -- GitLab