Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dsaad #16

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
57 changes: 57 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This is a basic workflow to help you get started with Actions

name: CI-CD

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
CI:
# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Docker Login
uses: docker/login-action@v2.0.0
with:
username: ${{secrets.DOCKERHUB_USER}}
password: ${{secrets.DOCKERHUB_PWD}}

- name: Build and push Docker images
uses: docker/build-push-action@v3.1.1
with:
file: ./src/Dockerfile
context: ./src
push: true
tags: |
asfcjr/kube-news:latest
asfcjr/kube-news:${{github.run_number}}
CD:
runs-on: ubuntu-latest
needs: [CI]
steps:
- uses: actions/checkout@v3
- name: Kubernetes Set Context
uses: Azure/k8s-set-context@v3.0
with:
method: kubeconfig
kubeconfig: ${{secrets.K8S_CONFIG}}

- name: Deploy to Kubernetes cluster
uses: Azure/k8s-deploy@v4.3
with:
images: asfcjr/kube-news:${{github.run_number}}
manifests: |
k8s/deployment.yaml


4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

# # Dependency directories
node_modules/
iac/terraform.tfvars
k8s/kube_config.yaml
# jspm_packages/

# # TypeScript v1 declaration files
Expand Down Expand Up @@ -103,4 +105,4 @@ node_modules/
# # TernJS port file
# .tern-port

*.Identifier
*.Identifier
1 change: 1 addition & 0 deletions iac/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform.tfvars
45 changes: 45 additions & 0 deletions iac/.terraform.lock.hcl

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

Loading