Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Closes Issue: #

### Addition

- put new additions here

### Changes

- put changes here

### Fixes

- put fixes here
98 changes: 98 additions & 0 deletions .github/workflows/kops-deploy-stage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build and Deploy for JS(npm) service

on:
push:
branches: [development]

env:
APP_NAME: ui-components
NAMESPACE: kops-dev-stg
CLUSTER_NAME: raramuri-tech
CLUSTER_PROJECT: raramuri-tech
GAR_PROJECT: raramuri-tech
GAR_REGISTRY: kops-dev

jobs:
dockerize:
runs-on: ubuntu-latest
name: 🐳 Dockerize

outputs:
image: ${{ steps.output-image.outputs.image }}

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "18.x"

- name: Install dependencies
run: |
echo "@zopsmart:registry=https://npm.pkg.github.com/" >> ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.PAT }}" >> ~/.npmrc
npm install --legacy-peer-deps
# - name: run linter
# run: |
# CI=false npm run lint
# - name: run prettier
# run: |
# CI=false npm run prettier:check

# - name: run tests
# run: |
# CI=false npm run test:coverage
- name: Build
run: npm run build

- name: Login to GAR
uses: docker/login-action@v2
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.STAGE_DEPLOY_KEY }}

- name: Build and Push Docker Image to GAR
uses: docker/build-push-action@v2
with:
push: true
context: .
file: ./Dockerfile
tags:
us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{
env.APP_NAME }}:${{ github.sha }}
- id: output-image
run:
echo "image=`echo us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY
}}/${{ env.APP_NAME }}:${{ github.sha }}`" >> "$GITHUB_OUTPUT"

deployment:
runs-on: ubuntu-latest
needs: dockerize
name: 🚀 Deploy
container:
image: ghcr.io/zopsmart/gha-images:deployments-0.1.3
options: --rm
env:
image: ${{ needs.dockerize.outputs.image }}

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Authorize to GCP service account
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.STAGE_DEPLOY_KEY }}

- name: Set GCloud Project and Fetch Cluster Credentials
run:
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region=us-central1
--project=${{ env.CLUSTER_PROJECT }}

- name: Update Deployment Image using Kubectl
run:
kubectl set image deployment/${{ env.APP_NAME }} ${{ env.APP_NAME }}=${{ env.image }}
--namespace ${{ env.NAMESPACE }}
98 changes: 98 additions & 0 deletions .github/workflows/kops-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build and Deploy for JS(npm) service

on:
push:
branches: [main]

env:
APP_NAME: ui-components
NAMESPACE: kops-dev
CLUSTER_NAME: raramuri-tech
CLUSTER_PROJECT: raramuri-tech
GAR_PROJECT: raramuri-tech
GAR_REGISTRY: kops-dev

jobs:
dockerize:
runs-on: ubuntu-latest
name: 🐳 Dockerize

outputs:
image: ${{ steps.output-image.outputs.image }}

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "18.x"

- name: Install dependencies
run: |
echo "@zopsmart:registry=https://npm.pkg.github.com/" >> ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.PAT }}" >> ~/.npmrc
npm install --legacy-peer-deps
# - name: run linter
# run: |
# CI=false npm run lint
# - name: run prettier
# run: |
# CI=false npm run prettier:check

# - name: run tests
# run: |
# CI=false npm run test:coverage
- name: Build
run: npm run build

- name: Login to GAR
uses: docker/login-action@v2
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.PROD_DEPLOY_KEY }}

- name: Build and Push Docker Image to GAR
uses: docker/build-push-action@v2
with:
push: true
context: .
file: ./Dockerfile
tags:
us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{
env.APP_NAME }}:${{ github.sha }}
- id: output-image
run:
echo "image=`echo us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY
}}/${{ env.APP_NAME }}:${{ github.sha }}`" >> "$GITHUB_OUTPUT"

deployment:
runs-on: ubuntu-latest
needs: dockerize
name: 🚀 Deploy
container:
image: ghcr.io/zopsmart/gha-images:deployments-0.1.3
options: --rm
env:
image: ${{ needs.dockerize.outputs.image }}

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Authorize to GCP service account
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.PROD_DEPLOY_KEY }}

- name: Set GCloud Project and Fetch Cluster Credentials
run:
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region=us-central1
--project=${{ env.CLUSTER_PROJECT }}

- name: Update Deployment Image using Kubectl
run:
kubectl set image deployment/${{ env.APP_NAME }} ${{ env.APP_NAME }}=${{ env.image }}
--namespace ${{ env.NAMESPACE }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# dependencies
/node_modules
/storybook-static
/.pnp
.pnp.js

Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# base image nginx for serving content
FROM nginx

WORKDIR /usr/share/nginx/html

#remove default conf files of nginx
RUN rm /etc/nginx/nginx.conf

#copy nginx.conf to container
COPY nginx.conf /etc/nginx/

#copy build to container
COPY storybook-static .
# COPY .well-known .well-known

EXPOSE 8000
CMD ["nginx", "-g", "daemon off;"]
29 changes: 29 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
user nobody nogroup;
worker_processes auto; # auto-detect number of logical CPU cores

events {
worker_connections 512; # set the max number of simultaneous connections (per worker process)
}

http {
server {
include mime.types;
listen *:8000; # Listen for incoming connections from any interface on port 80
server_name ""; # Don't worry if "Host" HTTP Header is empty or not set
root /usr/share/nginx/html; # serve static files from here

location / {
try_files $uri $uri/ /index.html;
}
# location /.well-known/health-check {
# access_log off;
# return 200 "healthy\n";
# add_header Content-Type text/plain;
# }
# location /.well-known/heartbeat {
# access_log off;
# return 200 "healthy\n";
# add_header Content-Type text/plain;
# }
}
}
Loading
Loading