vishnoianil commited on
Commit
b0b8a90
·
unverified ·
1 Parent(s): 3ac733e

Add github job to build image (and not publish) on PR creation (#20)

Browse files
Files changed (1) hide show
  1. .github/workflows/images-dryrun.yml +105 -0
.github/workflows/images-dryrun.yml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Dry run docling-serve image building
2
+
3
+ on:
4
+ pull_request:
5
+ branches: ["main"]
6
+
7
+ env:
8
+ GHCR_REGISTRY: ghcr.io
9
+ GHCR_DOCLING_SERVE_CPU_IMAGE_NAME: ds4sd/docling-serve-cpu
10
+ GHCR_DOCLING_SERVE_GPU_IMAGE_NAME: ds4sd/docling-serve
11
+
12
+ jobs:
13
+ build_cpu_image:
14
+ name: Build docling-serve "CPU only" container image
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ packages: write
18
+ contents: read
19
+ attestations: write
20
+ id-token: write
21
+
22
+ steps:
23
+ - name: Check out the repo
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Set up Docker Buildx
27
+ uses: docker/setup-buildx-action@v3
28
+
29
+ - name: Cache Docker layers
30
+ uses: actions/cache@v4
31
+ with:
32
+ path: /tmp/.buildx-cache
33
+ key: ${{ runner.os }}-buildx-${{ github.sha }}
34
+ restore-keys: |
35
+ ${{ runner.os }}-buildx-
36
+
37
+ - name: Extract metadata (tags, labels) for docling-serve (CPU only) ghcr image
38
+ id: ghcr_serve_cpu_meta
39
+ uses: docker/metadata-action@v5
40
+ with:
41
+ images: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_DOCLING_SERVE_CPU_IMAGE_NAME }}
42
+
43
+ - name: Build docling-serve-cpu image
44
+ id: build-serve-cpu-ghcr
45
+ uses: docker/build-push-action@v5
46
+ with:
47
+ context: .
48
+ push: false
49
+ tags: ${{ steps.ghcr_serve_cpu_meta.outputs.tags }}
50
+ labels: ${{ steps.ghcr_serve_cpu_meta.outputs.labels }}
51
+ platforms: linux/amd64
52
+ cache-from: type=gha
53
+ cache-to: type=gha,mode=max
54
+ file: Containerfile
55
+ build-args: |
56
+ --build-arg CPU_ONLY=true
57
+
58
+ - name: Remove Local Docker Images
59
+ run: |
60
+ docker image prune -af
61
+
62
+ build_gpu_image:
63
+ name: Build docling-serve (with GPU support) container image
64
+ runs-on: ubuntu-latest
65
+ permissions:
66
+ packages: write
67
+ contents: read
68
+ attestations: write
69
+ id-token: write
70
+
71
+ steps:
72
+ - name: Check out the repo
73
+ uses: actions/checkout@v4
74
+
75
+ - name: Set up Docker Buildx
76
+ uses: docker/setup-buildx-action@v3
77
+
78
+ - name: Cache Docker layers
79
+ uses: actions/cache@v4
80
+ with:
81
+ path: /tmp/.buildx-cache
82
+ key: ${{ runner.os }}-buildx-${{ github.sha }}
83
+ restore-keys: |
84
+ ${{ runner.os }}-buildx-
85
+
86
+ - name: Extract metadata (tags, labels) for docling-serve (GPU) ghcr image
87
+ id: ghcr_serve_gpu_meta
88
+ uses: docker/metadata-action@v5
89
+ with:
90
+ images: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_DOCLING_SERVE_GPU_IMAGE_NAME }}
91
+
92
+ - name: Build docling-serve (GPU) image
93
+ id: build-serve-gpu-ghcr
94
+ uses: docker/build-push-action@v5
95
+ with:
96
+ context: .
97
+ push: false
98
+ tags: ${{ steps.ghcr_serve_gpu_meta.outputs.tags }}
99
+ labels: ${{ steps.ghcr_serve_gpu_meta.outputs.labels }}
100
+ platforms: linux/amd64,linux/arm64
101
+ cache-from: type=gha
102
+ cache-to: type=gha,mode=max
103
+ file: Containerfile
104
+ build-args: |
105
+ --build-arg CPU_ONLY=false