diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2d1e7cc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Cache Bun Dependencies + uses: actions/cache@v3 + with: + path: "**/node_modules\n~/.bun" + key: "${{ runner.os }}-bun-${{ hashFiles('**/package.json') }}" + + - name: Install Client Dependencies + working-directory: client + run: bun install + + - name: Build Client + working-directory: client + run: bun run build + + - name: Install Server Dependencies + working-directory: server + run: bun install \ No newline at end of file diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/deploy.yml similarity index 53% rename from .github/workflows/build-deploy.yml rename to .github/workflows/deploy.yml index cf71221..16a2fe7 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,37 +1,30 @@ -name: Build and Deploy +name: Deploy on: - push: - branches: [master] + workflow_run: + workflows: ["Build"] + types: + - completed jobs: - build: + deploy: + name: Deploy to Server + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest + steps: - name: Checkout Repository uses: actions/checkout@v3 - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: "20" - - - name: Install bun - run: | - npm install -g bun - - - name: Build web client - run: | - cd client && bun install && bun run build - - name: Deploy using SSH uses: appleboy/ssh-action@master with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.SSH_PRIVATE_KEY }} + host: "${{ secrets.HOST }}" + username: "${{ secrets.USERNAME }}" + key: "${{ secrets.SSH_PRIVATE_KEY }}" port: 22 script: | + set -e cd /home if [ ! -d "Server-Tracker" ]; then @@ -40,25 +33,25 @@ jobs: cd Server-Tracker git reset --hard origin/master - git pull origin + git pull origin master - cd /home/Server-Tracker/client && bun install + cd client + bun install rm -f .env - echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> .env - + echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" > .env bunx next build - cd /home/Server-Tracker/server && bun install + cd ../server + bun install rm -f .env echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" > .env echo "MONGODB_URL=${{ secrets.MONGODB_URL }}" >> .env - cd /home/Server-Tracker - + cd .. docker build ./client -t tracker-web docker build ./server -t tracker-server docker container prune --force docker image prune --force - docker compose up -d + docker compose up -d \ No newline at end of file diff --git a/client/dockerfile b/client/dockerfile index c968979..0612fc6 100644 --- a/client/dockerfile +++ b/client/dockerfile @@ -1,22 +1,25 @@ -FROM ubuntu:latest - -# Update the package list -RUN apt-get update && apt-get autoremove -y +FROM node:22-slim # Environment variables -ENV DEBIAN_FRONTEND=noninteractive +ENV DEBIAN_FRONTEND=noninteractive \ + PATH="/root/.bun/bin:${PATH}" ARG FRONTEND_PORT ENV FRONTEND_PORT=$FRONTEND_PORT # Install some basic tools -RUN apt-get install -y nano wget curl git unzip zip - -# Install Node.js -RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh -RUN bash nodesource_setup.sh -RUN apt-get install -y nodejs - +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + git \ + unzip \ + zip \ + nano \ + wget && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + # Set the working directory COPY . /app WORKDIR /app @@ -27,6 +30,10 @@ RUN chmod +x /app/entrypoint.sh # Install Bun RUN curl -fsSL https://bun.sh/install | bash +# Add bun to PATH +ENV BUN_INSTALL="/root/.bun" +ENV PATH="$BUN_INSTALL/bin:$PATH" + # Expose the port EXPOSE ${FRONTEND_PORT} diff --git a/client/entrypoint.sh b/client/entrypoint.sh index 4b154dd..b802bab 100644 --- a/client/entrypoint.sh +++ b/client/entrypoint.sh @@ -2,7 +2,5 @@ FRONTEND_PORT="${FRONTEND_PORT:-3006}" -~/.bun/bin/bun install -~/.bun/bin/bun next telemetry disable -~/.bun/bin/bun run build -~/.bun/bin/bun run start -- -H 0.0.0.0 -p "$FRONTEND_PORT" +bun next telemetry disable +bun run start -- -H 0.0.0.0 -p "$FRONTEND_PORT" diff --git a/client/package.json b/client/package.json index 9e4da7d..8df1329 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "tracker", - "version": "1.0.2", + "version": "1.0.3", "private": true, "scripts": { "dev": "next dev --turbopack", @@ -10,22 +10,22 @@ "lint": "next lint" }, "dependencies": { - "@next/third-parties": "^14.2.33", - "next": "16.1.5", + "@next/third-parties": "^14.2.35", + "next": "^16.1.6", "next-sitemap": "^4.2.3", "react": "^18.3.1", "react-dom": "^18.3.1", "react-icons": "^5.5.0", - "update-browserslist-db": "^1.1.4" + "update-browserslist-db": "^1.2.3" }, "devDependencies": { "typescript": "^5.9.3", - "@types/node": "^20.19.23", - "@types/react": "^18.3.26", + "@types/node": "^20.19.32", + "@types/react": "^18.3.28", "@types/react-dom": "^18.3.7", "postcss": "^8.5.6", - "tailwindcss": "^3.4.18", + "tailwindcss": "^3.4.19", "eslint": "^8.57.1", "eslint-config-next": "14.2.4" } -} +} \ No newline at end of file diff --git a/client/public/sitemap-0.xml b/client/public/sitemap-0.xml index c767c27..11c4cd5 100644 --- a/client/public/sitemap-0.xml +++ b/client/public/sitemap-0.xml @@ -1,4 +1,4 @@ -https://track.rishon.systems2026-01-21T21:28:44.876Zdaily0.7 +https://track.rishon.systems2026-02-06T10:05:16.720Zdaily0.7 \ No newline at end of file diff --git a/client/tsconfig.json b/client/tsconfig.json index 7248658..4b6b903 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -14,7 +14,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve", + "jsx": "react-jsx", "incremental": true, "plugins": [ { @@ -22,7 +22,9 @@ } ], "paths": { - "@/*": ["./src/*"] + "@/*": [ + "./src/*" + ] }, "target": "ES2017" }, diff --git a/server/dockerfile b/server/dockerfile index 73583b4..ca1db1a 100644 --- a/server/dockerfile +++ b/server/dockerfile @@ -1,7 +1,4 @@ -FROM ubuntu:latest - -# Update the package list -RUN apt-get update && apt-get autoremove -y +FROM node:22-slim # Environment variables ENV DEBIAN_FRONTEND=noninteractive @@ -10,12 +7,17 @@ ARG BACKEND_PORT ENV BACKEND_PORT=$BACKEND_PORT # Install some basic tools -RUN apt-get install -y nano wget curl git unzip zip - -# Install Node.js -RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh -RUN bash nodesource_setup.sh -RUN apt-get install -y nodejs +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + git \ + unzip \ + zip \ + nano \ + wget && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* # Set the working directory COPY . /server @@ -27,7 +29,9 @@ RUN chmod +x /server/entrypoint.sh # Install Bun RUN curl -fsSL https://bun.sh/install | bash -RUN npm i -g bun +# Add bun to PATH +ENV BUN_INSTALL="/root/.bun" +ENV PATH="$BUN_INSTALL/bin:$PATH" # Expose the port EXPOSE ${BACKEND_PORT} diff --git a/server/package.json b/server/package.json index 4c36530..94dbd32 100644 --- a/server/package.json +++ b/server/package.json @@ -1,7 +1,7 @@ { "name": "server", "module": "index.ts", - "version": "1.0.1", + "version": "1.0.3", "type": "module", "scripts": { "start": "bun run index.ts", @@ -14,9 +14,9 @@ "typescript": "^5.9.2" }, "dependencies": { - "@hytaleone/query": "^1.0.1", + "@hytaleone/query": "^1.1.1", "dotenv": "^16.6.1", "minecraft-server-ping": "^0.1.4", - "mongoose": "^8.19.2" + "mongoose": "^8.22.1" } -} +} \ No newline at end of file