From e296f41198fcfa2b0ea08e681d60d4b650bba121 Mon Sep 17 00:00:00 2001 From: supphakitd <67319010028@technictrang.ac.th> Date: Fri, 21 Nov 2025 10:24:38 +0700 Subject: [PATCH] workflow: initial testing Signed-off-by: supphakitd <67319010028@technictrang.ac.th> --- .gitea/workflows/build-image.yml | 26 ++++++++++++++++++++++++++ Dockerfile | 16 ++++++++++++++++ entrypoint | 3 +++ test.sh | 1 + 4 files changed, 46 insertions(+) create mode 100644 .gitea/workflows/build-image.yml create mode 100644 Dockerfile create mode 100644 entrypoint create mode 100644 test.sh diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml new file mode 100644 index 0000000..2de461e --- /dev/null +++ b/.gitea/workflows/build-image.yml @@ -0,0 +1,26 @@ +name: Build Docker Image +run-name: Build Docker Image +on: [push] + +jobs: + Build Docker Image: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Install system dependencies + run: | + # change mirror to kku.ac.th for faster package downloading + sudo sed -i 's@http://archive.ubuntu.com@http://mirror.kku.ac.th@g' /etc/apt/sources.list.d/ubuntu.sources + sudo apt update && sudo apt install nodejs npm curl -y + - name: Install project dependencies + run: | + npm install + - name: Testing APIs + run: | + ./test.sh + - name: Build docker image + run: | + docker build . -t accounting-api:latest + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c7d9a27 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine:latest + +ADD entrypoint /entrypoint +RUN apk update && apk add npm +RUN chmod +x ./entrypoint + +RUN mkdir server + +ADD node_modules /server +ADD package-lock.json /server +ADD package.json /server + +ADD exthernal-login-api /server +ADD exthernal-ttc-api /server + +ENTRYPOINT ["/entrypoint"] diff --git a/entrypoint b/entrypoint new file mode 100644 index 0000000..d9cddc8 --- /dev/null +++ b/entrypoint @@ -0,0 +1,3 @@ +#!/bin/sh + +cd server/exthernal-login-api && exec npm run dev diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..cc1f786 --- /dev/null +++ b/test.sh @@ -0,0 +1 @@ +#!/bin/bash \ No newline at end of file