diff --git a/.dockerignore b/.dockerignore index 4a257c2..4a97e1b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -103,3 +103,6 @@ ENV/ # documentation docs + +# Node +node_modules diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 07a03f0..61a177a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,7 +12,7 @@ jobs: name: ubuntu-latest - Docker - lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Run hadolint uses: reviewdog/action-hadolint@v1 @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set Environment Variables run: | @@ -38,7 +38,7 @@ jobs: - name: Set up QEMU id: qemu-setup - uses: docker/setup-qemu-action@master + uses: docker/setup-qemu-action@v3 with: platforms: all @@ -47,21 +47,21 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@master + uses: docker/setup-buildx-action@v3 with: driver: docker-container use: true - name: Login to DockerHub if: github.event_name == 'push' - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push latest if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags') && github.ref == 'refs/heads/master' - uses: docker/build-push-action@master + uses: docker/build-push-action@v6 with: context: . builder: ${{ steps.buildx.outputs.name }} @@ -72,8 +72,8 @@ jobs: TENTACLES_URL_TAG=${{ env.LATEST }} - name: Build and push on tag - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: docker/build-push-action@master + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aa63c00..c80f547 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,9 +23,9 @@ jobs: type: [ sources ] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: 3.13.x architecture: x64 @@ -63,9 +63,9 @@ jobs: name: Source distribution - Python - deploy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: 3.13.x architecture: x64 diff --git a/Dockerfile b/Dockerfile index 8614ad1..2e14352 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,13 @@ -FROM python:3.13-slim-buster AS base +FROM node:22-slim AS frontend + +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY octobot_script/resources/report/ octobot_script/resources/report/ +COPY vite.config.ts tsconfig*.json ./ +RUN npm run build + +FROM python:3.13-slim-bullseye AS base WORKDIR /app @@ -7,6 +16,7 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential git gcc binutils COPY . . +COPY --from=frontend /app/octobot_script/resources/report/dist/ octobot_script/resources/report/dist/ RUN pip3 install --no-cache-dir -U setuptools wheel pip \ && pip3 install --no-cache-dir -r requirements.txt \ diff --git a/setup.py b/setup.py index 54b54c2..aea5dec 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,10 @@ def _build_report(): + if os.path.isfile(REPORT_DIST): + print(f"[report] Pre-built bundle found → {REPORT_DIST}, skipping JS build.") + return + npm = "npm" print("[report] Installing JS dependencies…")