From fd3aa6b84f69004d23aba0287989258d583c9720 Mon Sep 17 00:00:00 2001 From: wsc-admin Date: Thu, 2 Apr 2026 19:35:50 +0900 Subject: [PATCH] Initial commit --- .gitea/workflows/ci.yaml | 24 ++++++++++++++++++++++++ .gitignore | 4 ++++ .npmrc | 1 + Dockerfile | 7 +++++++ README.md | 3 +++ main.js | 11 +++++++++++ package.json | 8 ++++++++ 7 files changed, 58 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 main.js create mode 100644 package.json 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..8c47867 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node:20-alpine +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +EXPOSE 80 +CMD ["node", "main.js"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..47399ab --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Node App + +Your REST API backend should listen on port 80 \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..5497c74 --- /dev/null +++ b/main.js @@ -0,0 +1,11 @@ +const express = require('express') +const app = express() +const PORT = 80 + +app.get('/', (req, res) => { + res.json({ message: 'Hello from Node App!' }) +}) + +app.listen(PORT, () => { + console.log(`Server running on port ${PORT}`) +}) \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..6631e51 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "node-app", + "private": true, + "version": "1.0.0", + "dependencies": { + "express": "^4.21.0" + } +} \ No newline at end of file