Skip to content

Commit

Permalink
change cache
Browse files Browse the repository at this point in the history
  • Loading branch information
TOwInOK committed Oct 26, 2024
1 parent 3d861ab commit 5b4bd6d
Showing 1 changed file with 8 additions and 31 deletions.
39 changes: 8 additions & 31 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:

- name: Run Clippy
run: cargo clippy -- -D warnings

docker-build:
needs: rust-checks
runs-on: ubuntu-latest
Expand All @@ -65,8 +66,6 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug

- name: Login to Container Registry
uses: docker/login-action@v3
Expand All @@ -75,15 +74,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Restore cache
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
Expand All @@ -93,40 +83,27 @@ jobs:
type=raw,value=latest
type=sha,format=short
labels: |
org.opencontainers.image.title=Shuller Bot
org.opencontainers.image.description=Discord Bot
org.opencontainers.image.title=luuma
org.opencontainers.image.description=Anime picture fetcher bot
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
maintainer=towinok
- name: Build and push
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: |
type=local,src=/tmp/.buildx-cache
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: |
type=local,dest=/tmp/.buildx-cache-new,mode=max
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
outputs: |
type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Временный фикс для кэша
- name: Move cache
if: always()
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max

- name: Check image
- name: Verify Docker image
if: success()
run: |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker image ls ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker image inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# deploy:
# needs: docker-build
# runs-on: ubuntu-latest
Expand Down

0 comments on commit 5b4bd6d

Please sign in to comment.