From 963d1c38a28eec96733eada9e31367cf48495fcb Mon Sep 17 00:00:00 2001 From: yaswanth-deriv <121096908+yaswanth-deriv@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:05:10 +0400 Subject: [PATCH] build: to add docker/k8 setup to deriv com (#5932) * build: to add docker/k8 setup to deriv com * build: to add docker/k8 setup to deriv com * build: to add docker/k8 setup to deriv com * refactor: removed CA in staging and production * Move the docker image build to after release * refactor: added docker after cloudflare --------- Co-authored-by: Ali(Ako) Hosseini --- .github/workflows/production.yml | 24 +++++++++++++++++++++++- .github/workflows/staging.yml | 24 +++++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index b26580ed972..7dfdb0ddee4 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -53,7 +53,6 @@ jobs: # For using same tag for staging and production we need to uncomment these two below lines: # with: # tagRegex: "production(.*)" - - name: Deploy to Cloudflare ☁️ uses: cloudflare/wrangler-action@2.0.0 with: @@ -64,6 +63,29 @@ jobs: - name: Cloudflare production link ✨ run: echo "New website - http://cf-pages-deriv-com.deriv.com" + - name: Building docker image 🐳 + run: docker build -t ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:latest -t ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME . + + - name: Verify nginx image + run: | + set -e + docker run --rm ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME nginx -t + echo "docker image validated successfully" + + - name: Pushing Image to docker hub 🐳 + run: | + echo ${{ secrets.DOCKERHUB_PASSWORD }}| docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin + docker push ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:latest + docker push ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME + + - name: Deploy 🚀 + run: | + export NAMESPACE="deriv-com-production" + git clone https://github.com/binary-com/devops-ci-scripts + cd devops-ci-scripts/k8s-build_tools + echo ${{ secrets.CA_CRT}} | base64 --decode > ca.crt + ./release.sh deriv-com $GIT_TAG_NAME + - name: Slack Notification 📣 uses: 8398a7/action-slack@v3 with: diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index e46c8aeab8f..35aa9f060d0 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -50,7 +50,6 @@ jobs: # For using same tag for staging and production we need to uncomment these two below lines: # with: # tagRegex: "staging(.*)" - - name: Deploy to Cloudflare ☁️ uses: cloudflare/wrangler-action@2.0.0 with: @@ -61,6 +60,29 @@ jobs: - name: Cloudflare preview link ✨ run: echo "New staging website - http://staging.cf-pages-deriv-com.deriv.com" + - name: Building docker image 🐳 + run: docker build -t ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:latest-staging -t ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GITHUB_SHA . + + - name: Verify nginx image + run: | + set -e + docker run --rm ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GITHUB_SHA nginx -t + echo "docker image validated successfully" + + - name: Pushing Image to docker hub 🐳 + run: | + echo ${{ secrets.DOCKERHUB_PASSWORD }}| docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin + docker push ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:latest-staging + docker push ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GITHUB_SHA + + - name: Deploy 🚀 + run: | + export NAMESPACE="deriv-com-staging" + git clone https://github.com/binary-com/devops-ci-scripts + cd devops-ci-scripts/k8s-build_tools + echo ${{ secrets.CA_CRT}} | base64 --decode > ca.crt + ./release.sh deriv-com $GITHUB_SHA + - name: Slack Notification 📣 uses: 8398a7/action-slack@v3 with: