mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
Refactor CI workflow to utilize Docker Buildx for building and pushing images
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 31s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Successful in 1m37s
CI/CD Pipeline / frontend-build (push) Failing after 2m21s
CI/CD Pipeline / e2e-test (push) Has been skipped
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 31s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Successful in 1m37s
CI/CD Pipeline / frontend-build (push) Failing after 2m21s
CI/CD Pipeline / e2e-test (push) Has been skipped
- Replace Kaniko commands with Docker Buildx for frontend and backend builds - Implement Docker login and setup steps for improved authentication - Enhance caching strategy by specifying cache-from and cache-to options - Streamline Dockerfile and context paths for clarity and maintainability
This commit is contained in:
parent
3f25e3a786
commit
ab0c778651
@ -42,22 +42,25 @@ jobs:
|
||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build and push frontend with Kaniko
|
||||
run: |
|
||||
mkdir -p /tmp/kaniko-docker
|
||||
echo "{\"auths\":{\"registry.bk.glpx.pro\":{\"username\":\"${{ secrets.DOCKER_USERNAME }}\",\"password\":\"${{ secrets.DOCKER_PASSWORD }}\"}}}" > /tmp/kaniko-docker/config.json
|
||||
docker run --rm \
|
||||
-v $(pwd):/workspace \
|
||||
-v /tmp/kaniko-docker:/kaniko/.docker \
|
||||
-e DOCKER_CONFIG=/kaniko/.docker \
|
||||
gcr.io/kaniko-project/executor:v1.24.0 \
|
||||
--dockerfile=/workspace/bugulma/frontend/Dockerfile \
|
||||
--context=/workspace/bugulma/frontend \
|
||||
--destination=registry.bk.glpx.pro/turash/turash-frontend:latest \
|
||||
--destination=registry.bk.glpx.pro/turash/turash-frontend:${{ gitea.sha }} \
|
||||
--cache=true \
|
||||
--cache-ttl=168h \
|
||||
--compressed-caching=false
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.bk.glpx.pro
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build and push frontend
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: bugulma/frontend
|
||||
file: bugulma/frontend/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
registry.bk.glpx.pro/turash/turash-frontend:latest
|
||||
registry.bk.glpx.pro/turash/turash-frontend:${{ gitea.sha }}
|
||||
cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache
|
||||
cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache,mode=max
|
||||
|
||||
backend-lint:
|
||||
runs-on: ubuntu-latest
|
||||
@ -108,22 +111,25 @@ jobs:
|
||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build and push backend with Kaniko
|
||||
run: |
|
||||
mkdir -p /tmp/kaniko-docker
|
||||
echo "{\"auths\":{\"registry.bk.glpx.pro\":{\"username\":\"${{ secrets.DOCKER_USERNAME }}\",\"password\":\"${{ secrets.DOCKER_PASSWORD }}\"}}}" > /tmp/kaniko-docker/config.json
|
||||
docker run --rm \
|
||||
-v $(pwd):/workspace \
|
||||
-v /tmp/kaniko-docker:/kaniko/.docker \
|
||||
-e DOCKER_CONFIG=/kaniko/.docker \
|
||||
gcr.io/kaniko-project/executor:v1.24.0 \
|
||||
--dockerfile=/workspace/bugulma/backend/Dockerfile \
|
||||
--context=/workspace/bugulma/backend \
|
||||
--destination=registry.bk.glpx.pro/turash/turash-backend:latest \
|
||||
--destination=registry.bk.glpx.pro/turash/turash-backend:${{ gitea.sha }} \
|
||||
--cache=true \
|
||||
--cache-ttl=168h \
|
||||
--compressed-caching=false
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.bk.glpx.pro
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build and push backend
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: bugulma/backend
|
||||
file: bugulma/backend/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
registry.bk.glpx.pro/turash/turash-backend:latest
|
||||
registry.bk.glpx.pro/turash/turash-backend:${{ gitea.sha }}
|
||||
cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache
|
||||
cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache,mode=max
|
||||
|
||||
e2e-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Loading…
Reference in New Issue
Block a user