From f577d2673be5c2770ba6a28cacc23bc6ebed1cc3 Mon Sep 17 00:00:00 2001 From: wsc-admin Date: Thu, 2 Apr 2026 19:35:47 +0900 Subject: [PATCH] Initial commit --- .gitea/workflows/ci.yaml | 24 ++++++++++++++++++++++++ .gitignore | 4 ++++ .npmrc | 1 + Dockerfile | 14 ++++++++++++++ README.md | 1 + index.html | 12 ++++++++++++ nginx.conf | 9 +++++++++ package.json | 22 ++++++++++++++++++++++ public/vite.svg | 0 src/App.css | 3 +++ src/App.tsx | 18 ++++++++++++++++++ src/index.css | 2 ++ src/main.tsx | 10 ++++++++++ tsconfig.json | 16 ++++++++++++++++ vite.config.ts | 6 ++++++ 15 files changed, 142 insertions(+) create mode 100644 .gitea/workflows/ci.yaml create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 index.html create mode 100644 nginx.conf create mode 100644 package.json create mode 100644 public/vite.svg create mode 100644 src/App.css create mode 100644 src/App.tsx create mode 100644 src/index.css create mode 100644 src/main.tsx create mode 100644 tsconfig.json create mode 100644 vite.config.ts diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..80fcc00 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,24 @@ +name: Build and deploy +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Build Docker image + run: DOCKER_BUILDKIT=0 docker build --network=wsc2026-infra_wsc-network . --tag git.webtech.worldskillskorea.io/${{ github.repository }}:latest + + - name: Login to registry + run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.webtech.worldskillskorea.io -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin + + - name: Push image + run: docker push git.webtech.worldskillskorea.io/${{ github.repository }}:latest + + - name: Deploy + run: | + curl -s -X POST https://admin.webtech.worldskillskorea.io/api/deploy \ + -H "Authorization: Bearer ${{ secrets.PULLDECK_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{"image":"git.webtech.worldskillskorea.io/${{ github.repository }}:latest"}' \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e9b06f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +dist +.DS_Store +*.local \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..55ef363 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +registry=http://verdaccio.webtech.worldskillskorea.io \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4ac4ce9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# build stage +FROM node:20-alpine as build-stage +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +# production stage +FROM nginx:1.19.0 as production-stage +COPY --from=build-stage /app/dist /usr/share/nginx/html +EXPOSE 80 +COPY nginx.conf /etc/nginx/conf.d/default.conf +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ea7df61 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# React + TypeScript + Vite \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..8d7eb0c --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + React TS App + + +
+ + + \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..764f902 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,9 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html/; + include /etc/nginx/mime.types; + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..26eb4d3 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "react-ts-app", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "preview": "vite preview" + }, + "dependencies": { + "react": "^19.0.0", + "react-dom": "^19.0.0" + }, + "devDependencies": { + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.3.4", + "typescript": "~5.7.2", + "vite": "^6.2.0" + } +} \ No newline at end of file diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..e69de29 diff --git a/src/App.css b/src/App.css new file mode 100644 index 0000000..7e27752 --- /dev/null +++ b/src/App.css @@ -0,0 +1,3 @@ +.App { text-align: center; padding: 2rem; } +h1 { color: #61dafb; } +button { font-size: 1rem; padding: 0.5rem 1rem; cursor: pointer; } \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..38e0cf5 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,18 @@ +import { useState } from 'react' +import './App.css' + +function App(): JSX.Element { + const [count, setCount] = useState(0) + + return ( +
+

Hello React + TypeScript!

+ +

Edit src/App.tsx to get started.

+
+ ) +} + +export default App \ No newline at end of file diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..218260f --- /dev/null +++ b/src/index.css @@ -0,0 +1,2 @@ +:root { font-family: Inter, system-ui, sans-serif; } +body { margin: 0; display: flex; place-items: center; min-height: 100vh; } \ No newline at end of file diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..cbe1cdf --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.tsx' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root')!).render( + + + , +) \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..20b58b6 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "bundler", + "strict": true, + "jsx": "react-jsx", + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + "noEmit": true + }, + "include": ["src"] +} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..3e34260 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +export default defineConfig({ + plugins: [react()], +}) \ No newline at end of file