mirror of
https://github.com/Snigdha-OS/snigdhaos-docker.git
synced 2025-12-06 12:03:52 +01:00
🐛 fix(_caching): docker layers
This commit is contained in:
58
.github/workflows/snigdhaos-docker.yml
vendored
58
.github/workflows/snigdhaos-docker.yml
vendored
@@ -3,7 +3,7 @@ name: Snigdha OS Docker Image
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 05 * * *'
|
- cron: '30 05 * * *' # Cron schedule for automatic builds (adjust as needed)
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
@@ -11,26 +11,50 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
-
|
# Checkout repository
|
||||||
name: Checkout
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up QEMU
|
# Set up QEMU for multi-architecture builds
|
||||||
uses: docker/setup-qemu-action@v3
|
- name: Set up QEMU
|
||||||
-
|
uses: docker/setup-qemu-action@v2
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
# Set up Docker Buildx for advanced builds (multi-arch, caching)
|
||||||
-
|
- name: Set up Docker Buildx
|
||||||
name: Login to Docker Hub
|
uses: docker/setup-buildx-action@v2
|
||||||
uses: docker/login-action@v3
|
|
||||||
|
# Login to Docker Hub using secrets for security
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
|
||||||
name: Build and push
|
# Cache Docker layers to speed up build time
|
||||||
uses: docker/build-push-action@v6
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
# Build and push Docker image with multi-architecture support
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: snigdhaos/snigdhaos:latest
|
tags: snigdhaos/snigdhaos:latest
|
||||||
|
platforms: linux/amd64,linux/arm64 # Support for multiple architectures
|
||||||
|
cache-from: type=registry,ref=snigdhaos/snigdhaos:latest # Enable cache from Docker registry
|
||||||
|
|
||||||
|
# Optionally, tag the build with a version from GitHub
|
||||||
|
- name: Tag Docker image with version
|
||||||
|
run: |
|
||||||
|
VERSION=$(git describe --tags --abbrev=0)
|
||||||
|
docker tag snigdhaos/snigdhaos:latest snigdhaos/snigdhaos:${VERSION}
|
||||||
|
docker push snigdhaos/snigdhaos:${VERSION}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user