fix build
Some checks failed
Build and Deploy Backend / Build Backend Docker Image (push) Failing after 5s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Has been skipped
Build and Deploy Backend / Notify Deployment Status (push) Failing after 1s

This commit is contained in:
Warunee Tamkoo 2026-02-10 11:22:52 +07:00
parent fa5993147b
commit c35f4ce688

View file

@ -29,41 +29,81 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Login to Docker Registry - name: Log in to Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY_URL }}
username: ${{ env.REGISTRY_USERNAME }} username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }} password: ${{ env.REGISTRY_PASSWORD }}
- name: Set up Docker Buildx - name: Build Docker image (no buildx)
uses: docker/setup-buildx-action@v3 run: |
with: # Build using standard docker build (not buildx)
config-inline: | cd ${{ github.workspace }}
[registry."${{ env.REGISTRY }}"] docker build \
http = true --no-cache \
insecure = true --pull \
--file ./Backend/Dockerfile \
--tag ${{ env.REGISTRY_URL }}/${{ env.BACKEND_IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
--tag ${{ env.REGISTRY_URL }}/${{ env.BACKEND_IMAGE_NAME }}:latest \
.
- name: Extract metadata echo "✅ Build successful!"
id: meta docker images | grep ${{ env.BACKEND_IMAGE_NAME }}
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix=
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/dev' }}
- name: Build and push Docker image - name: Push Docker image
uses: docker/build-push-action@v5 run: |
with: docker push ${{ env.REGISTRY_URL }}/${{ env.BACKEND_IMAGE_NAME }}:${{ env.IMAGE_TAG }}
context: ./Backend docker push ${{ env.REGISTRY_URL }}/${{ env.BACKEND_IMAGE_NAME }}:latest
file: ./Backend/Dockerfile echo "✅ Image pushed to registry"
push: true
tags: ${{ steps.meta.outputs.tags }} - name: Test image can run
labels: ${{ steps.meta.outputs.labels }} run: |
cache-from: type=gha # Quick test that image can start
cache-to: type=gha,mode=max docker run --rm ${{ env.REGISTRY_URL }}/${{ env.BACKEND_IMAGE_NAME }}:${{ env.IMAGE_TAG }} node --version
# build:
# name: Build Backend Docker Image
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Login to Docker Registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ env.REGISTRY_USERNAME }}
# password: ${{ env.REGISTRY_PASSWORD }}
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# with:
# config-inline: |
# [registry."${{ env.REGISTRY }}"]
# http = true
# insecure = true
# - name: Extract metadata
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}
# tags: |
# type=ref,event=branch
# type=sha,prefix=
# type=raw,value=latest,enable=${{ github.ref == 'refs/heads/dev' }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: ./Backend
# file: ./Backend/Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
deploy: deploy:
name: Deploy E-learning Backend to Dev Server name: Deploy E-learning Backend to Dev Server