Skip to content

Commit

Permalink
- build red-app
Browse files Browse the repository at this point in the history
  • Loading branch information
ubaid4j committed Jul 21, 2024
1 parent f2ddfd3 commit 7a01e63
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 0 deletions.
File renamed without changes.
53 changes: 53 additions & 0 deletions .github/workflows/red-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Red App

env:
REGISTRY: ghcr.io
IMAGE_NAME: ubaid4j/multiple-apps-routing/red-app
VERSION: 0.0.1-SNAPSHOT

on:
push:
paths:
- 'red-app/**'
branches:
- main

defaults:
run:
working-directory: ./api-gateway

jobs:
package:
name: Package and Publish
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
security-events: write
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Build Container Image
run: |
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} .
- name: OCI Image vulnerability scanning
uses: anchore/scan-action@v3
id: scan
with:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
fail-build: true
only-fixed: true
severity-cutoff: critical
- name: Upload vulnerability report
uses: github/codeql-action/upload-sarif@v3
if: success()
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
- name: Login to container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish container image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
6 changes: 6 additions & 0 deletions deployment/k8s/api-gateway/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ spec:
value: '80'
- name: SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_CUSTOMER1_ISSUER_URI
value: 'http://keycloak/realms/customer1'
- name: RED_APP_URL
value: http://red-app
- name: GREEN_APP_URL
value: http://green-app
- name: BLUE_APP_URL
value: http://blue-app
livenessProbe:
httpGet:
path: /management/health/liveness
Expand Down
5 changes: 5 additions & 0 deletions red-app/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.idea
.gitignore
.angular
.vscode
12 changes: 12 additions & 0 deletions red-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:22-alpine3.20 as build
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build

FROM nginx:alpine
COPY --from=build /app/dist/red-app/browser /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
17 changes: 17 additions & 0 deletions red-app/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
server {

listen 80;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}

}

0 comments on commit 7a01e63

Please sign in to comment.