From 6a507c42cdf243c5618df82d918b269a9be3cf74 Mon Sep 17 00:00:00 2001 From: warrenwjk Date: Sat, 11 May 2024 20:03:44 +0800 Subject: [PATCH] Add actions for docker image. --- .github/workflows/docker-hub-backend.yml | 39 ++++++++++++++++++++++++ .github/workflows/docker-hub-worker.yml | 39 ++++++++++++++++++++++++ .github/workflows/pages.yml | 2 +- frontend/app/page.tsx | 2 +- 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-hub-backend.yml create mode 100644 .github/workflows/docker-hub-worker.yml diff --git a/.github/workflows/docker-hub-backend.yml b/.github/workflows/docker-hub-backend.yml new file mode 100644 index 0000000..74b72a6 --- /dev/null +++ b/.github/workflows/docker-hub-backend.yml @@ -0,0 +1,39 @@ +name: Docker Image for Backend + +on: + push: + tags: + - '**' +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: 'backend' + sparse-checkout-cone-mode: false + # All files should be moved to the project root. + - name: Move app files to root + run: | + ls -lah + shopt -s dotglob + mv backend/* . + rm -rf backend + ls -lah + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: am009 + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: am009/latexdiff-web-backend:latest,am009/latexdiff-web-backend:${{ github.ref_name }} diff --git a/.github/workflows/docker-hub-worker.yml b/.github/workflows/docker-hub-worker.yml new file mode 100644 index 0000000..f3c8957 --- /dev/null +++ b/.github/workflows/docker-hub-worker.yml @@ -0,0 +1,39 @@ +name: Docker Image for Worker + +on: + push: + tags: + - '**' +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: 'worker' + sparse-checkout-cone-mode: false + # All files should be moved to the project root. + - name: Move app files to root + run: | + ls -lah + shopt -s dotglob + mv worker/* . + rm -rf worker + ls -lah + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: am009 + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: am009/latexdiff-web-worker:latest,am009/latexdiff-web-worker:${{ github.ref_name }} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index daa3d53..40712d2 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -31,7 +31,7 @@ jobs: sparse-checkout: 'frontend' sparse-checkout-cone-mode: false # All files should be moved to the project root. - - name: Move mobile app files to root + - name: Move app files to root run: | ls -lah shopt -s dotglob diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 32b789a..785ccf8 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -73,7 +73,7 @@ export default function Home() { }, []); const [fields, setFields] = useState({ - "api_endpoint": "latexdiff.cn", + "api_endpoint": "backend.latexdiff.cn", "main_tex": "main.tex", "other_cmdlines": "--latexopt -shell-escape --ignore-latex-errors", "download_diff_proj": false,