From 735f2790a86bb4248c4d966b7bde5fdbc9ec3034 Mon Sep 17 00:00:00 2001 From: Tham Luu Date: Mon, 23 Sep 2024 17:39:17 +0800 Subject: [PATCH 1/2] Create docker file --- Dockerfile | 16 ++++++++++------ docker-compose.yml | 14 ++++++++++++++ src/pages/Home.jsx | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index e4294c7..a87dc56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,18 @@ -FROM node:18.19.0-alpine3.19 +FROM node:18.20.4-alpine3.20 -WORKDIR /app/client +WORKDIR /app +RUN npm install -g pnpm COPY package*.json . -RUN npm i +COPY pnpm-lock.yaml . +RUN pnpm install --prefer-offline=true --frozen-lockfile=true +RUN npm i -g serve COPY . . ENV NODE_ENV=production -ENV VITE_LOGIN_KEY=7fo24CMyIc -EXPOSE 5000 +RUN pnpm build -CMD ["npm", "run", "dev"] +EXPOSE 3000 + +CMD [ "serve", "-s", "dist" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..911e82b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + fuware: + container_name: fuware-fe + image: fuware-fe:dev + build: + context: ../ + target: production + dockerfile: ./Dockerfile + restart: always + ports: + - 3000:3000 + environment: + NODE_ENV: 'production' + VITE_LOGIN_KEY: '7fo24CMyIc' diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index 854d5a1..31b4eb3 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -24,7 +24,7 @@ export default function Home() { const first = getFirstItem(NAV_ITEM(t, auth?.userInfo?.isAdmin)) navigate(first ? first.pathName : PathConstants.PROFILE) } - }, [auth.userInfo.isAdmin]) + }, [auth.userInfo?.isAdmin]) return <> } -- 2.47.2 From b2ae96a397bd716ac84c036577c6632607c6d6f1 Mon Sep 17 00:00:00 2001 From: Sam Liu Date: Tue, 24 Sep 2024 16:47:30 +0700 Subject: [PATCH 2/2] [FW-0] update runner --- .gitea/workflows/test-self.yaml | 21 +++++++++++++++++++++ docker-compose.yml | 5 ++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .gitea/workflows/test-self.yaml diff --git a/.gitea/workflows/test-self.yaml b/.gitea/workflows/test-self.yaml new file mode 100644 index 0000000..15ac577 --- /dev/null +++ b/.gitea/workflows/test-self.yaml @@ -0,0 +1,21 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 + +on: + push: + branches: [develop] + +jobs: + check: + runs-on: self-hosted + defaults: + run: + working-directory: /home/raysam/act-runner-host/repo + steps: + - run: git --version + - run: rm -rf fuware-fe + - run: git clone ssh://git@thamluu.synology.me:222/sam/fuware-fe.git fuware-fe + - name: run docker + working-directory: /home/raysam/act-runner-host/repo/fuware-fe + run: docker compose up --build -d + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/docker-compose.yml b/docker-compose.yml index 911e82b..b111976 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,13 @@ services: fuware: container_name: fuware-fe - image: fuware-fe:dev + image: fuware-fe build: context: ../ target: production dockerfile: ./Dockerfile restart: always ports: - - 3000:3000 + - 16001:3000 environment: NODE_ENV: 'production' - VITE_LOGIN_KEY: '7fo24CMyIc' -- 2.47.2