diff --git a/Dockerfile b/Dockerfile index a020e7d..a4cd2d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ # Use an official Node.js runtime as the builder image -FROM node:16-alpine +FROM node:20-alpine + +ARG GITHUB_TOKEN + +ENV GITHUB_TOKEN $GITHUB_TOKEN # Set the working directory inside the container WORKDIR /app @@ -10,8 +14,12 @@ COPY package.json ./ # Copy the yarn.lock file to the container COPY yarn.lock ./ +COPY .npmrc ./ + # Install the app dependencies -RUN yarn install +RUN echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> .npmrc +RUN yarn install --frozen-lockfile && yarn cache clean +RUN rm -f .npmrc # Copy the tsconfig.json to be able to compile the typescript COPY tsconfig.json ./ diff --git a/cloudrun.yaml b/cloudrun.yaml deleted file mode 100644 index c85ead3..0000000 --- a/cloudrun.yaml +++ /dev/null @@ -1,85 +0,0 @@ -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - generation: 4 - labels: - cloud.googleapis.com/location: europe-west1 - name: merkl-dispute-base # metadata.name -spec: - template: - metadata: - annotations: - autoscaling.knative.dev/maxScale: '2' - autoscaling.knative.dev/minScale: '0' - spec: - containerConcurrency: '1' - containers: - - env: - - name: CHAINID - value: "8453" # spec.template.spec.containers.env[0].value - - name: ENV - value: dev - - name: DISPUTE_BOT_PRIVATE_KEY - valueFrom: - secretKeyRef: - key: latest - name: DISPUTE_BOT_PRIVATE_KEY - - name: PROVIDER_1 - valueFrom: - secretKeyRef: - key: latest - name: PROVIDER_1 - - name: PROVIDER_10 - valueFrom: - secretKeyRef: - key: latest - name: PROVIDER_10 - - name: PROVIDER_137 - valueFrom: - secretKeyRef: - key: latest - name: PROVIDER_137 - - name: PROVIDER_42161 - valueFrom: - secretKeyRef: - key: latest - name: PROVIDER_42161 - - name: PROVIDER_1101 - valueFrom: - secretKeyRef: - key: latest - name: PROVIDER_1101 - - name: PROVIDER_8453 - valueFrom: - secretKeyRef: - key: latest - name: PROVIDER_8453 - - name: DISCORD_TOKEN - valueFrom: - secretKeyRef: - key: latest - name: DISCORD_TOKEN - - name: KEEPER_GITHUB_AUTH_TOKEN - valueFrom: - secretKeyRef: - key: latest - name: KEEPER_GITHUB_AUTH_TOKEN - image: europe-west1-docker.pkg.dev/merkl-dispute-2/registry/merkl-dispute:v0.0.4 # spec.template.spec.containers.image - ports: - - containerPort: '5002' - name: http1 - resources: - limits: - cpu: '1' - memory: 1Gi - startupProbe: - failureThreshold: 1 - periodSeconds: 240 - tcpSocket: - port: '5002' - timeoutSeconds: 240 - serviceAccountName: merkl-dispute-sa@merkl-dispute-2.iam.gserviceaccount.com # spec.template.spec.serviceAccountName - timeoutSeconds: '600' - traffic: - - latestRevision: true - percent: 100 diff --git a/package.json b/package.json index b0b15d3..3bb35e9 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "devDependencies": { "@types/express": "^4.17.13", "@types/graceful-fs": "^4.1.5", - "@types/node": "^16.9.6", + "@types/node": "^20.9.2", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "eslint": "^8.1.0", diff --git a/scripts/publish.sh b/scripts/publish.sh index 3a7820a..762ce41 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,9 +1,10 @@ #!/bin/bash account=$1 version=$2 +token=$3 echo "Building docker image" -docker build -t merkl-dispute:latest --platform linux/amd64 . +docker build --build-arg GITHUB_TOKEN=$token -t merkl-dispute:latest --platform linux/amd64 . docker tag merkl-dispute:latest europe-west1-docker.pkg.dev/$account/registry/merkl-dispute:$version diff --git a/scripts/publishAndDeploy.sh b/scripts/publishAndDeploy.sh index bc3cfbd..84ee3f8 100755 --- a/scripts/publishAndDeploy.sh +++ b/scripts/publishAndDeploy.sh @@ -6,5 +6,8 @@ read version echo "Please enter the account to deploy to: (merkl-dispute-1 or merkl-dispute-2)" read account -sh scripts/publish.sh $account $version +echo "Please enter Github token to download the SDK" +read token + +sh scripts/publish.sh $account $version $token bash scripts/deploy.sh $account $version diff --git a/yarn.lock b/yarn.lock index a440250..061d187 100644 --- a/yarn.lock +++ b/yarn.lock @@ -900,10 +900,12 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.2.tgz#fa6a90f2600e052a03c18b8cb3fd83dd4e599898" integrity sha512-vOBLVQeCQfIcF/2Y7eKFTqrMnizK5lRNQ7ykML/5RuwVXVWxYkgwS7xbt4B6fKCUPgbSL5FSsjHQpaGQP/dQmw== -"@types/node@^16.9.6": - version "16.18.37" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.37.tgz#a1f8728e4dc30163deb41e9b7aba65d0c2d4eda1" - integrity sha512-ql+4dw4PlPFBP495k8JzUX/oMNRI2Ei4PrMHgj8oT4VhGlYUzF4EYr0qk2fW+XBVGIrq8Zzk13m4cvyXZuv4pA== +"@types/node@^20.9.2": + version "20.9.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.2.tgz#002815c8e87fe0c9369121c78b52e800fadc0ac6" + integrity sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg== + dependencies: + undici-types "~5.26.4" "@types/pbkdf2@^3.0.0": version "3.1.0" @@ -3893,6 +3895,11 @@ underscore@~1.13.2: resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441" integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + undici@^5.22.0: version "5.22.1" resolved "https://registry.yarnpkg.com/undici/-/undici-5.22.1.tgz#877d512effef2ac8be65e695f3586922e1a57d7b"