-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf564bd
commit 65f06a2
Showing
2 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# This is a workflow that is build and deploy the backend | ||
|
||
name: Backend | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'backend/**' | ||
|
||
env: | ||
REGISTRY: 3a7jouokyffroregistry.azurecr.io | ||
REGISTRY_USER: 3a7jouokyffroregistry | ||
IMAGE_NAME: palansa/backend:latest | ||
NAMESPACE: palansa | ||
# 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 "greet" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
# Runs a single command using the runners shell | ||
- name: Docker Build | ||
working-directory: ./backend | ||
run: | | ||
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} -f ./Dockerfile . | ||
- name: Docker Push Image | ||
run: | | ||
echo ${{ secrets.REGISTRY_SECRET }} | docker login ${{ env.REGISTRY }} -u ${{ env.REGISTRY_USER }} --password-stdin | ||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
deploy: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- uses: azure/k8s-set-context@v3 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.KUBECONFIG }} | ||
|
||
- name: Create or Patch docker pull secret | ||
run: | | ||
kubectl create secret docker-registry docker-pull-secret \ | ||
--save-config --dry-run=client \ | ||
--docker-username=${{ env.REGISTRY_USER }} \ | ||
--docker-password=${{ secrets.REGISTRY_SECRET }} \ | ||
[email protected] \ | ||
--docker-server=${{ env.REGISTRY }} \ | ||
-n ${{ env.NAMESPACE }} -o yaml | \ | ||
kubectl apply -f - | ||
- name: Create or Patch db secret | ||
run: | | ||
kubectl create secret generic db-url \ | ||
--save-config --dry-run=client \ | ||
--from-literal=url=${{ secrets.DB_URL }} \ | ||
-n ${{ env.NAMESPACE }} -o yaml | \ | ||
kubectl apply -f - | ||
- name: Deploy backend | ||
working-directory: ./backend/k8s | ||
run: | | ||
kubectl apply -f . -n ${{ env.NAMESPACE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# This is a workflow that is build and deploy the frontend | ||
|
||
name: Frontend | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'frontend/**' | ||
|
||
env: | ||
REGISTRY: 3a7jouokyffroregistry.azurecr.io | ||
REGISTRY_USER: 3a7jouokyffroregistry | ||
IMAGE_NAME: palansa/frontend:latest | ||
NAMESPACE: palansa | ||
# 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 "greet" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
# Runs a single command using the runners shell | ||
- name: Docker Build | ||
working-directory: ./frontend | ||
run: | | ||
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} -f ./Dockerfile . | ||
- name: Docker Push Image | ||
run: | | ||
echo ${{ secrets.REGISTRY_SECRET }} | docker login ${{ env.REGISTRY }} -u ${{ env.REGISTRY_USER }} --password-stdin | ||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
deploy: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- uses: azure/k8s-set-context@v3 | ||
with: | ||
method: kubeconfig | ||
kubeconfig: ${{ secrets.KUBECONFIG }} | ||
|
||
- name: Create or Patch docker pull secret | ||
run: | | ||
kubectl create secret docker-registry docker-pull-secret \ | ||
--save-config --dry-run=client \ | ||
--docker-username=${{ env.REGISTRY_USER }} \ | ||
--docker-password=${{ secrets.REGISTRY_SECRET }} \ | ||
[email protected] \ | ||
--docker-server=${{ env.REGISTRY }} \ | ||
-n ${{ env.NAMESPACE }} -o yaml | \ | ||
kubectl apply -f - | ||
- name: Create or Patch ngnix.conf | ||
working-directory: ./frontend | ||
run: | | ||
kubectl create configmap nginx \ | ||
--save-config --dry-run=client \ | ||
--from-file=nginx.conf \ | ||
-n ${{ env.NAMESPACE }} -o yaml | \ | ||
kubectl apply -f - | ||
- name: Deploy Frontend | ||
working-directory: ./frontend/k8s | ||
run: | | ||
kubectl apply -f . -n ${{ env.NAMESPACE }} |