From 7a3328aa445217ad056d615be1de6ee55fc753c1 Mon Sep 17 00:00:00 2001 From: taha-moujtahid Date: Mon, 6 Apr 2026 20:41:24 +0000 Subject: [PATCH] Add nextjs-build.yml --- nextjs-build.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 nextjs-build.yml diff --git a/nextjs-build.yml b/nextjs-build.yml new file mode 100644 index 0000000..4d59bc5 --- /dev/null +++ b/nextjs-build.yml @@ -0,0 +1,56 @@ +on: + workflow_call: + inputs: + working_dir: + required: false + type: string + default: '.' + image_name: + required: true + type: string + registry: + required: false + type: string + default: 'git.moujtahid.com' + secrets: + REGISTRY_USER: + required: true + REGISTRY_PASSWORD: + required: true + +env: + REGISTRY: git.moujtahid.com + DOCKER_HOST: tcp://localhost:2375 + +jobs: + build-and-push: + runs-on: ubuntu-latest + env: + DOCKER_HOST: tcp://localhost:2375 + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker + driver-opts: | + image=moby/buildkit:latest + + - name: Login to Registry + uses: docker/login-action@v3 + with: + registry: ${{ inputs.registry }} + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: ${{ inputs.working_dir }} + push: true + tags: | + ${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:latest + ${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:${{ gitea.sha }} + cache-from: type=registry,ref=${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:cache + cache-to: type=registry,ref=${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:cache,mode=max \ No newline at end of file