diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 645e359..80fec42 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,24 +1,33 @@
-name: Publish Image
+name: Build and Push Docker Image
+
 on:
-  - push
+  push:
+    branches: [ main ]
+  pull_request:
+    branches: [ main ]
 
 jobs:
-  publish-image:
+  build-and-push:
     runs-on: ubuntu-latest
     steps:
-      - name: Checkout code
-        uses: actions/checkout@v3.3.0
-        with:
-          fetch-depth: 20
-          submodules: 'recursive'
-      - name: Login to GitHub Container Registry
-        uses: docker/login-action@v1
-        with:
-          registry: ghcr.io
-          username: ${{ github.actor }}
-          password: ${{ secrets.GITHUB_TOKEN }}
-      - name: Build the runpod-template-pytorch2 Docker image
-        run: |
-          docker build . --tag ghcr.io/deepghs/pytorch-conda-image:latest
-          docker push ghcr.io/deepghs/pytorch-conda-image:latest
+    - uses: actions/checkout@v2
+
+    - name: Set up Docker Buildx
+      uses: docker/setup-buildx-action@v1
+
+    - name: Login to DockerHub
+      uses: docker/login-action@v1
+      with:
+        username: narugo1992
+        password: ${{ secrets.DCR_TOKEN }}
+
+    - name: Build and push
+      uses: docker/build-push-action@v2
+      with:
+        context: .
+        push: true
+        tags: narugo1992/pytorch-conda-image:latest
+
+    - name: Image digest
+      run: echo ${{ steps.docker_build.outputs.digest }}