Skip to content

Commit

Permalink
Update keycloak themes to use keycloakify
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Dec 4, 2024
1 parent 39a35e3 commit b0452c4
Show file tree
Hide file tree
Showing 56 changed files with 9,997 additions and 647 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended"
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/no-redeclare": "off",
"no-labels": "off"
},
overrides: [
{
files: ["**/*.stories.*"],
rules: {
"import/no-anonymous-default-export": "off"
}
}
]
};
105 changes: 0 additions & 105 deletions .github/workflows/build-themes-container.yml

This file was deleted.

107 changes: 107 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Publish opensrp 2 themes images

on:
push:
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*

pull_request:
# Run Tests when changes are made to the Docker file
paths:
- 'Dockerfile'

workflow_dispatch:
inputs:
customTag:
description: "Includes the specified tag to docker image tags"
required: true

jobs:
# Run image build test
test:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- uses: actions/checkout@v4
- name: Run Build tests
run: docker build . --file Dockerfile

push:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
opensrp/keycloak-themes
tags: |
type=ref,event=branch,key=main,tag=latest
type=ref,event=branch,pattern=release/*,group=1
type=ref,event=tag
type=sha
# Add a custom tag if provided through workflow_dispatch input
type=raw,value=${{ github.event.inputs.customTag }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to Docker Image Repositories
uses: docker/build-push-action@v6
id: docker_build
with:
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.meta.outputs.tags }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

- name: Scan Docker Image with Docker Scout and Save Report
id: scout
run: |
# Save the Docker Scout report as JSON and Markdown
docker scout cves ${{ steps.meta.outputs.tags }} --output json > scout-report.json
docker scout cves ${{ steps.meta.outputs.tags }} --output markdown > scout-report.md
- name: Check Docker Scout Scan Result
id: check-scout-result
run: |
# Check if any vulnerabilities are reported in the JSON output
if grep -q '"severity":' scout-report.json; then
echo "Vulnerabilities found in Docker Scout report."
echo "found_vulnerabilities=true" >> $GITHUB_ENV
else
echo "No vulnerabilities found."
echo "found_vulnerabilities=false" >> $GITHUB_ENV
- name: Create GitHub Issue for Vulnerabilities
if: env.found_vulnerabilities == 'true'
uses: peter-evans/create-issue-from-file@v4
with:
title: "Docker Scout Vulnerability Report for Image ${{ steps.meta.outputs.tags }}"
content-filepath: scout-report.md
labels: |
"Security Support"
"Bug Report"
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# yarn cache directory
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions


# Optional REPL history
.node_repl_history

.vscode

.DS_Store

/dist

/dist_keycloak
/build
/storybook-static
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(node --version)
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
/dist/
/dist_keycloak/
/public/keycloakify-dev-resources/
/.vscode/
/.yarn_home/
25 changes: 25 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"printWidth": 90,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"overrides": [
{
"files": [
"**/login/pages/*.tsx",
"**/account/pages/*.tsx",
"**/login/Template.tsx",
"**/account/Template.tsx",
"**/login/UserProfileFormFields.tsx",
"KcApp.tsx"
],
"options": {
"printWidth": 150
}
}
]
}
5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules
18 changes: 16 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
FROM busybox
FROM node:22-alpine AS build

COPY themes/ /themes/
RUN apt-get update \
&& apt-get install -y maven

WORKDIR /srv
ADD package.json .
ADD yarn.lock .

RUN yarn
ADD . .
RUN yarn build-keycloak-theme

FROM node:22-alpine
COPY --from=build /srv/dist_keycloak/ /srv/

CMD ["sh"]
5 changes: 0 additions & 5 deletions Dockerfile.dev

This file was deleted.

Loading

0 comments on commit b0452c4

Please sign in to comment.