Vikramjeet Singh commited on
Commit
668c539
1 Parent(s): 0b222f0

Update docker-image.yml

Browse files

Former-commit-id: 5837c894962bfd6e7e9352fcbb84ef0e2d0947a6
Former-commit-id: 97178c625792489ca031b9f296badce34fd6f14f

Files changed (1) hide show
  1. .github/workflows/docker-image.yml +23 -5
.github/workflows/docker-image.yml CHANGED
@@ -7,12 +7,30 @@ on:
7
  branches: [ "main" ]
8
 
9
  jobs:
10
-
11
  build:
12
-
13
  runs-on: ubuntu-latest
14
 
15
  steps:
16
- - uses: actions/checkout@v4
17
- - name: Build the Docker image
18
- run: docker build . --file ./Dockerfile --tag picpilot:$(date +%s)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  branches: [ "main" ]
8
 
9
  jobs:
 
10
  build:
 
11
  runs-on: ubuntu-latest
12
 
13
  steps:
14
+ - name: Check out the repository
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Set up Docker Buildx
18
+ uses: docker/setup-buildx-action@v2
19
+
20
+ - name: Log in to Docker Hub
21
+ uses: docker/login-action@v2
22
+ with:
23
+ username: ${{ secrets.DOCKER_USERNAME }}
24
+ password: ${{ secrets.DOCKER_PASSWORD }}
25
+
26
+ - name: Cache Docker layers
27
+ uses: actions/cache@v3
28
+ with:
29
+ path: /tmp/.buildx-cache
30
+ key: ${{ runner.os }}-buildx-${{ github.sha }}
31
+ restore-keys: |
32
+ ${{ runner.os }}-buildx-
33
+
34
+ - name: Build and push Docker image
35
+ run: |
36
+ docker buildx build --file ./Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/picpilot:$(date +%s) --push --cache-to=type=local,dest=/tmp/.buildx-cache,new=true --cache-from=type=local,src=/tmp/.buildx-cache .