-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 91cf604
Showing
49 changed files
with
1,785 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,22 @@ | ||
name: Repo sync with Cloud π Native | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
mirror: | ||
name: Sync repo with Cloud π Native | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checks-out repository | ||
uses: actions/checkout@v3 | ||
- name: Send a sync request to DSO api | ||
run: | | ||
sh ./ci/mirror.sh \ | ||
-a "${{ env.DSO_API_URL }}" \ | ||
-b "${{ github.ref_name }}" \ | ||
-g "${{ secrets.GITLAB_TRIGGER_TOKEN }}" \ | ||
-i "${{ secrets.GITLAB_PROJECT_ID }}" |
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 @@ | ||
node_modules |
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,46 @@ | ||
include: | ||
- project: $CATALOG_PATH | ||
file: | ||
- vault-ci.yml | ||
- kaniko-ci.yml | ||
- sonar-ci.yml | ||
ref: main | ||
|
||
default: | ||
image: alpine:latest | ||
|
||
variables: | ||
REGISTRY_URL: ${REGISTRY_HOST}/${PROJECT_PATH} | ||
|
||
stages: | ||
- read-secret | ||
- check-quality | ||
- docker-build | ||
|
||
read_secret: | ||
stage: read-secret | ||
extends: .vault:read_secret | ||
|
||
sonarqube: | ||
image: docker.io/sonarsource/sonar-scanner-cli:latest | ||
stage: check-quality | ||
variables: | ||
SONAR_PROJECT_KEY: ${PROJECT_KEY} | ||
extends: .sonar:sonar-scanner | ||
allow_failure: true | ||
|
||
docker-build-client: | ||
variables: | ||
WORKING_DIR: ./apps/client | ||
DOCKERFILE: ./apps/client/Dockerfile | ||
IMAGE_NAMES: tuto-client:1.0.0 tuto-client:latest | ||
stage: docker-build | ||
extends: .kaniko:build-push | ||
|
||
docker-build-server: | ||
variables: | ||
WORKING_DIR: ./apps/server | ||
DOCKERFILE: ./apps/server/Dockerfile | ||
IMAGE_NAMES: tuto-server:1.0.0 tuto-server:latest | ||
stage: docker-build | ||
extends: .kaniko:build-push |
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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,43 @@ | ||
ARG BASE_IMAGE=docker.io/oven/bun:1.1.8 | ||
ARG PROD_IMAGE=docker.io/bitnami/nginx:1.24.0 | ||
|
||
# Base | ||
FROM ${BASE_IMAGE} AS base | ||
|
||
WORKDIR /app | ||
COPY ./package.json ./bun.lockb ./ | ||
|
||
|
||
# Install | ||
FROM base AS install | ||
|
||
COPY ./ ./ | ||
RUN bun install --ignore-scripts | ||
|
||
|
||
# Dev | ||
FROM base AS dev | ||
|
||
COPY --from=install /app/node_modules ./node_modules | ||
COPY ./ ./ | ||
ENTRYPOINT [ "bun", "run", "dev" ] | ||
|
||
|
||
# Build | ||
FROM base AS build | ||
|
||
ENV NODE_ENV=production | ||
COPY --from=install /app/node_modules ./node_modules | ||
COPY ./ ./ | ||
RUN bun run build | ||
|
||
|
||
# Prod | ||
FROM ${PROD_IMAGE} AS prod | ||
|
||
USER 0 | ||
COPY --chown=1001:0 --chmod=770 --from=build /app/dist /opt/bitnami/nginx/html/ | ||
COPY --chown=1001:0 --chmod=660 ./nginx/nginx-static.conf /opt/bitnami/nginx/conf/server_blocks/default.conf | ||
COPY --chown=1001:0 ./nginx/entrypoint.sh /docker-entrypoint-initdb.d/load-env.sh | ||
USER 1001 | ||
EXPOSE 8080 |
Binary file not shown.
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,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Cloud Pi Native</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
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,19 @@ | ||
#!/bin/sh | ||
|
||
ROOT_DIR=/opt/bitnami/nginx/html | ||
|
||
populate () { | ||
KEY=$(echo "app-$1" | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g') | ||
VALUE=$(eval "echo \${$1}") | ||
sed -i 's|'${KEY}'|'${VALUE}'|g' $2 | ||
} | ||
|
||
|
||
echo "Replacing env constants in JS" | ||
for file in $ROOT_DIR/assets/*.js; do | ||
echo "Processing $file ..."; | ||
|
||
populate SERVER_HOST $file | ||
done | ||
|
||
nginx -g 'daemon off;' |
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,16 @@ | ||
server { | ||
listen 8080; | ||
server_name localhost; | ||
root /opt/bitnami/nginx/html; | ||
index index.html; | ||
|
||
large_client_header_buffers 4 32k; | ||
|
||
location / { | ||
try_files $uri $uri/ @rewrites; | ||
} | ||
|
||
location @rewrites { | ||
rewrite "^(.+)$" /index.html last; | ||
} | ||
} |
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,16 @@ | ||
{ | ||
"name": "client", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "bunx --bun vite --host --port 8080", | ||
"build": "tsc && vite build", | ||
"preview": "bunx --bun vite preview" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.2.2", | ||
"vite": "^5.2.0", | ||
"@types/bun": "^1.1.2" | ||
} | ||
} |
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,8 @@ | ||
export function getMsg(btn: HTMLButtonElement, msg: HTMLParagraphElement) { | ||
const getMsg = async () => { | ||
const res = await fetch(`/api`) | ||
const { docUrl, githubUrl } = JSON.parse(await res.text()) | ||
msg.innerHTML = `Welcome aboard !<br/><br/>Visit the <a href="${docUrl}" target="_blank">documentation</a> and the <a href="${githubUrl}" target="_blank">Github organization</a>.` | ||
} | ||
btn.addEventListener('click', () => getMsg()) | ||
} |
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,14 @@ | ||
import './style.css' | ||
import { getMsg } from './api.ts' | ||
|
||
document.querySelector<HTMLDivElement>('#app')!.innerHTML = ` | ||
<div> | ||
<h1>Cloud Pi Native</h1> | ||
<div class="card"> | ||
<button id="btn" type="button"> Click me</button> | ||
<p id="msg"></p> | ||
</div> | ||
</div> | ||
` | ||
|
||
getMsg(document.querySelector<HTMLButtonElement>('#btn')!, document.querySelector<HTMLParagraphElement>('#msg')!) |
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,96 @@ | ||
:root { | ||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; | ||
line-height: 1.5; | ||
font-weight: 400; | ||
|
||
color-scheme: light dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
a:hover { | ||
color: #535bf2; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
display: flex; | ||
place-items: center; | ||
min-width: 320px; | ||
min-height: 100vh; | ||
} | ||
|
||
h1 { | ||
font-size: 3.2em; | ||
line-height: 1.1; | ||
} | ||
|
||
#app { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
.logo.vanilla:hover { | ||
filter: drop-shadow(0 0 2em #3178c6aa); | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
} | ||
|
||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
background-color: #1a1a1a; | ||
cursor: pointer; | ||
transition: border-color 0.25s; | ||
} | ||
button:hover { | ||
border-color: #646cff; | ||
} | ||
button:focus, | ||
button:focus-visible { | ||
outline: 4px auto -webkit-focus-ring-color; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
color: #213547; | ||
background-color: #ffffff; | ||
} | ||
a:hover { | ||
color: #747bff; | ||
} | ||
button { | ||
background-color: #f9f9f9; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
/// <reference types="vite/client" /> |
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,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"module": "ESNext", | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"] | ||
} |
Oops, something went wrong.