Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

FEQ-878 / add docker and k8s setup #259

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/actions/deploy_to_kubernetes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: k8s_deploy
description: Deploy to Kubernetes
inputs:
TARGET:
description: Target environment
required: false
default: 'beta'
jim-deriv marked this conversation as resolved.
Show resolved Hide resolved
type: string
K8S_VERSION:
description: Kubernetes version
required: true
type: string
K8S_NAMESPACE:
description: Kubernetes namespace
required: false
type: string
default: 'deriv-com-api-staging'
CA_CRT:
description: Kubernetes CA certificate
required: true
type: string
steps:
- k8s/install-kubectl
- run:
name: Deploying to k8s cluster for service << ${{ inputs.K8S_NAMESPACE }} >>
command: |
export NAMESPACE=<< ${{ inputs.K8S_NAMESPACE }} >>
git clone https://github.com/binary-com/devops-ci-scripts
cd devops-ci-scripts/k8s-build_tools
echo ${{ inputs.CA_CRT }} | base64 --decode > ca.crt
./release.sh deriv-com-api << ${{ inputs.K8S_VERSION }} >>
jim-deriv marked this conversation as resolved.
Show resolved Hide resolved
36 changes: 36 additions & 0 deletions .github/actions/publish_to_docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: docker_build_push
description: Build and push Docker image to Docker Hub
inputs:
DOCKER_LATEST_IMAGE_TAG:
description: Docker image tag
required: false
default: 'latest-staging'
type: string
DOCKER_IMAGE_TAG:
description: Docker image tag
required: true
type: string
DOCKHUB_ORGANISATION:
description: Docker Hub organisation
required: true
type: string
DOCKERHUB_USERNAME:
description: Docker Hub username
required: true
type: string
DOCKERHUB_PASSWORD:
description: Docker Hub password
required: true
type: string
steps:
- setup_remote_docker
- run:
name: Building docker image
command: |
docker build -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >> -t ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >> .
jim-deriv marked this conversation as resolved.
Show resolved Hide resolved
- run:
name: Pushing Image to docker hub
command: |
echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u $${{ inputs.DOCKERHUB_USERNAME }} --password-stdin
docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_IMAGE_TAG }} >>
jim-deriv marked this conversation as resolved.
Show resolved Hide resolved
docker push ${{ inputs.DOCKHUB_ORGANISATION }}/deriv-com-api:<< ${{ inputs.DOCKER_LATEST_IMAGE_TAG }} >>
jim-deriv marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 14 additions & 0 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ jobs:
- name: Extract version
id: extract_version
run: echo "RELEASE_VERSION=$(cat build/version)" >> $GITHUB_OUTPUT
- name: Publish to Docker
uses: ./.github/actions/publish_to_docker
with:
DOCKER_LATEST_IMAGE_TAG: 'latest'
DOCKER_IMAGE_TAG: ${{ secrets.SHA1 }}
DOCKHUB_ORGANISATION: ${{ secrets.DOCKHUB_ORGANISATION }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy to Kubernetes
uses: ./.github/actions/deploy_to_kubernetes
with:
K8S_VERSION: ${{ secrets.SHA1 }}
ali-hosseini-deriv marked this conversation as resolved.
Show resolved Hide resolved
K8S_NAMESPACE: 'deriv-com-api-production'
CA_CRT: ${{ secrets.CA_CRT }}
- name: Publish to Cloudflare Pages Production
uses: ./.github/actions/publish_to_pages_production
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/release_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ jobs:
uses: ./.github/actions/build
with:
NODE_ENV: staging
- name: Publish to Docker
uses: ./.github/actions/publish_to_docker
with:
DOCKER_LATEST_IMAGE_TAG: 'latest-staging'
DOCKER_IMAGE_TAG: ${{ secrets.SHA1 }}
DOCKHUB_ORGANISATION: ${{ secrets.DOCKHUB_ORGANISATION }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy to Kubernetes
uses: ./.github/actions/deploy_to_kubernetes
with:
K8S_VERSION: ${{ secrets.SHA1 }}
ali-hosseini-deriv marked this conversation as resolved.
Show resolved Hide resolved
K8S_NAMESPACE: 'deriv-com-api-staging'
CA_CRT: ${{ secrets.CA_CRT }}
jim-deriv marked this conversation as resolved.
Show resolved Hide resolved
- name: Publish to Cloudflare Pages Staging
uses: ./.github/actions/publish_to_pages_staging
with:
Expand Down