Skip to content

Commit

Permalink
Merge pull request #1923 from opengovern/ui-changes
Browse files Browse the repository at this point in the history
feat: adding web ui
  • Loading branch information
mohamadch91 authored Nov 11, 2024
2 parents 20cb8d9 + 06959c5 commit 2505994
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 1 deletion.
77 changes: 77 additions & 0 deletions .github/workflows/ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: NodeJS with Webpack

on:
workflow_dispatch:
inputs:
deployTo:
type: choice
description: "Environment to deploy to"
options:
- "dev"
- "prod"
default: "dev"
push:
branches: [ "main" ]

jobs:
build:
environment: web
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write

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

- name: GitHub Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: NPM Cache
uses: actions/cache@v3
with:
path: |
~/.npm
~/.cache
./node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm install

- name: Build
env:
CI: false
run: npm run build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64 # Add multi-platform support

tags:
ghcr.io/${{ github.repository_owner }}/web-ui:${{ steps.tag_version.outputs.new_tag }}-${{ github.event.inputs.deployTo == '' && 'dev' || github.event.inputs.deployTo }}
file: docker/WebUiDockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ build/*
cache/*

# Environment files
*.env

# PEM files
*.pem
Expand Down
22 changes: 22 additions & 0 deletions assets/web-ui/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {

listen 7298;

# This block is to catch workspaces and redirect to workspace/dashboard
# location ~ ^(/(?!invitation|login|sign-up|workspaces))[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$ {
# rewrite ^((/(?!invitation|login|sign-up|workspaces))[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$) $1/dashboard redirect;
# }

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;
}

}
16 changes: 16 additions & 0 deletions docker/WebUiDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Prepare nginx
FROM docker.io/nginx:1.25.0-alpine
COPY ./build /usr/share/nginx/html
COPY ./.env.example /usr/share/nginx/html/.env
RUN rm /etc/nginx/conf.d/default.conf
COPY ./assets/web-ui/nginx.conf /etc/nginx/conf.d

RUN apk add --update npm
RUN npm i -g [email protected]

WORKDIR /usr/share/nginx/html

# Fire up nginx
EXPOSE 7298
#CMD ["nginx", "-g", "daemon off;"]
CMD ["/bin/sh", "-c", "runtime-env-cra && nginx -g \"daemon off;\""]

0 comments on commit 2505994

Please sign in to comment.