commit 3cbbc127c0bbe0b8205c9a3902eaf6494160e2a3 Author: wsc-admin Date: Thu Apr 2 19:35:52 2026 +0900 Initial commit 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..d06c674 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:20-alpine +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build +EXPOSE 80 +CMD ["npm", "run", "start-build"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..68e9ed6 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Node TypeScript App + +Your REST API backend should listen on port 80 \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..f79ac25 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "node-ts-app", + "private": true, + "version": "1.0.0", + "scripts": { + "dev": "ts-node src/main.ts", + "build": "tsc", + "start-build": "node dist/main.js" + }, + "dependencies": { + "express": "^4.21.0" + }, + "devDependencies": { + "@types/express": "^5.0.0", + "@types/node": "^22.0.0", + "typescript": "~5.7.2", + "ts-node": "^10.9.2" + } +} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..3010188 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,12 @@ +import express, { Request, Response } from 'express' + +const app = express() +const PORT = 80 + +app.get('/', (req: Request, res: Response) => { + res.json({ message: 'Hello from Node TS App!' }) +}) + +app.listen(PORT, () => { + console.log(`Server running on port ${PORT}`) +}) \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..db8e86a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true + }, + "include": ["src/**/*"] +} \ No newline at end of file