-
Notifications
You must be signed in to change notification settings - Fork 104
96 lines (80 loc) · 3.28 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: ci
on: [push, pull_request]
jobs:
build-bin:
name: bin
runs-on: ubuntu-22.04-xl
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Build and export image
run: |
docker build -f bin.dockerfile -t bin .
docker save bin -o /tmp/bin-image.tar
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: bin-image
path: /tmp/bin-image.tar
build:
needs: build-bin
name: ${{ matrix.kind }}
runs-on: ubuntu-22.04-xl
strategy:
matrix:
kind: ["alpine", "centos", "debian", "distroless", "ubuntu"]
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Download bin image artifact
uses: actions/download-artifact@v2
with:
name: bin-image
path: /tmp
- name: Load bin image
run: |
docker load --input /tmp/bin-image.tar
docker inspect bin
- name: Build image
run: |
docker build -f ${{ matrix.kind }}.dockerfile --build-arg BIN_IMAGE=bin -t ${{ matrix.kind }} .
- name: Test default CMD
run: |
docker run -t ${{ matrix.kind }}
- name: Test if entry script forwards to deno binary
run: |
docker run -t ${{ matrix.kind }} eval "console.log('Welcome to Deno!')"
# if typescript is present in the output, then probably deno --version worked
docker run -t ${{ matrix.kind }} --version | grep typescript
- name: Test if entry script forwards to other binaries
if: ${{ matrix.kind != 'distroless' }}
run: |
docker run -t ${{ matrix.kind }} deno eval "console.log('Welcome to Deno!')"
docker run -t ${{ matrix.kind }} echo 'test entry script'
- name: Login to Docker Hub
if: github.repository == 'denoland/deno_docker' && startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push named images
if: github.repository == 'denoland/deno_docker' && startsWith(github.ref, 'refs/tags/')
run: |
docker tag ${{ matrix.kind }} denoland/deno:${{ matrix.kind }}-${GITHUB_REF#refs/*/}
docker tag ${{ matrix.kind }} denoland/deno:${{ matrix.kind }}
docker push denoland/deno:${{ matrix.kind }}-${GITHUB_REF#refs/*/}
docker push denoland/deno:${{ matrix.kind }}
- name: Push bin image
if: github.repository == 'denoland/deno_docker' && startsWith(github.ref, 'refs/tags/') && matrix.kind == 'debian'
run: |
docker tag bin denoland/deno:bin-${GITHUB_REF#refs/*/}
docker tag bin denoland/deno:bin
docker push denoland/deno:bin-${GITHUB_REF#refs/*/}
docker push denoland/deno:bin
- name: Push default image
if: github.repository == 'denoland/deno_docker' && startsWith(github.ref, 'refs/tags/') && matrix.kind == 'debian'
run: |
docker tag ${{ matrix.kind }} denoland/deno:${GITHUB_REF#refs/*/}
docker tag ${{ matrix.kind }} denoland/deno:latest
docker push denoland/deno:${GITHUB_REF#refs/*/}
docker push denoland/deno:latest