Skip to content

Commit

Permalink
Merge pull request #19 from hypersign-protocol/CD
Browse files Browse the repository at this point in the history
update code
  • Loading branch information
Pratap2018 authored Dec 5, 2023
2 parents 15e1925 + d39788a commit e3d1ed0
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 13 deletions.
32 changes: 23 additions & 9 deletions .github/workflows/image-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ on:
- "master"

jobs:
build-push-artifact:
Build-and-Publish-to-google-artifact-repository:
runs-on: ubuntu-latest
environment: production
steps:
- name: code checkout
uses: actions/checkout@v3
Expand All @@ -24,22 +25,35 @@ jobs:
service_account_key: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
export_default_credentials: true
- name: "Use gcloud CLI"
run:
"gcloud info"
run: "gcloud info"

- name: "Docker Auth"
run:
gcloud auth configure-docker asia-south1-docker.pkg.dev
run: gcloud auth configure-docker asia-south1-docker.pkg.dev

- name: "Docker Build and Push"
env:
GOOGLE_PROJECT_ID: ${{secrets.GOOGLE_PROJECT_ID}}
GOOGLE_ARTIFACT_URL: ${{secrets.GOOGLE_ARTIFACT_URL}}
GOOGLE_ARTIFACT_REPO: ${{secrets.GOOGLE_ARTIFACT_REPO}}
run:
run:
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/vault-service:latest .

docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/vault-service:latest


docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/vault-service:latest

- name: "Replace secrets"
uses: cschleiden/replace-tokens@v1
with:
files: '["**/deployment.yaml"]'
tokenPrefix: "{"
tokenSuffix: "}"
env:
HOST: ${{secrets.HOST}}
ABSOLUTE_URL: ${{secrets.ABSOLUTE_URL}}
DATA_VAULT: ${{secrets.DATA_VAULT}}
DB_URL: ${{secrets.DB_URL}}
PORT: ${{secrets.PORT}}
LOG_LEVEL: ${{secrets.LOG_LEVEL}}
SSL: ${{secrets.SSL}}

- name: "Deploy to GKE"
run: kubctl apply -f deploy/deployment.yaml
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ COPY ./package.json .
COPY ./tsconfig.json .
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "run", "start:dev"]
RUN npm run build
CMD ["npm", "run", "start"]



Expand Down
79 changes: 79 additions & 0 deletions deploy/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: vault-app
namespace: hypermine-development
spec:
replicas: 1
selector:
matchLabels:
app: vault-app
template:
metadata:
labels:
app: vault-app
spec:
containers:
- name: vault-app
image: asia-south1-docker.pkg.dev/fyre-400407/hypersign-image-repository/vault-service:latest
# - name: vault-app
# image: paulbouwer/hello-kubernetes:1.5
resources:
limits:
memory: "1Gi"
cpu: "500m"
ports:
- containerPort: 3000
# protocol: TCP
env:
- name: HOST
value: { HOST }
- name: SSL
value: { HOST }
- name: ABSOLUTE_URL
value: { ABSOLUTE_URL }
- name: DATA_VAULT
value: { DATA_VAULT }
- name: DB_URL
value: { DB_URL }
- name: PORT
value: { PORT }
- name: LOG
value: { LOG }

---
apiVersion: v1
kind: Service
metadata:
name: vault-service
namespace: hypermine-development
spec:
type: LoadBalancer
selector:
app: vault-app
ports:
- port: { PORT }
targetPort: { PORT }
protocol: TCP
# apiVersion: networking.k8s.io/v1
# kind: Ingress
# metadata:
# name: ingress
# namespace: hypermine-development
# labels:
# name: ingress
# spec:
# rules:
# - http:
# paths:
# - pathType: ImplementationSpecific
# path: "/app1"
# backend:
# service:
# name: vault-service
# port:
# number: 80

# ---
---

5 changes: 5 additions & 0 deletions deploy/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: hypermine-development

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e3d1ed0

Please sign in to comment.