diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c4310eeee..0ac719871 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -17,6 +17,39 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: ./backend + push: true + tags: ghcr.io/datalab-mi/basegun/basegun-backend:${{ github.head_ref }} + target: dev + + test: + needs: build + runs-on: ubuntu-latest + container: + image: ghcr.io/datalab-mi/basegun/basegun-backend:${{ github.head_ref }} + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - run: pwd + - run: ls + - run: cd /app + - run: ls + build-and-test: uses: ./.github/workflows/test-on-kube.yml needs: tag-pr diff --git a/backend/Dockerfile b/backend/Dockerfile index 841f1a94e..e5c83798d 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -29,14 +29,9 @@ RUN mkdir -p src/weights \ && mv model.pth src/weights/model.pth \ && echo '{"app": "'${VERSION}'", "model": "'${MODEL}'"}' > versions.json -# launch website FROM base as dev -CMD ["uvicorn", "src.main:app", "--reload", "--host", "0.0.0.0", "--port", "5000"] - -FROM base as test -RUN pip install requests && rm -r /root/.cache COPY tests/ tests/ -CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5000"] +CMD ["uvicorn", "src.main:app", "--reload", "--host", "0.0.0.0", "--port", "5000"] FROM base as prod RUN pip install --extra-index-url https://download.pytorch.org/whl/cpu \