-
Notifications
You must be signed in to change notification settings - Fork 20
88 lines (73 loc) · 2.37 KB
/
ci.yaml
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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group:
${{ github.workflow }}-${{ github.ref_name }}-${{
github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build:
name: "build image"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v6
with:
tags: uv-docker-example:latest
cache-from: type=gha,scope=uv-docker-example
cache-to: type=gha,mode=min,scope=uv-docker-example
outputs: type=docker,dest=/tmp/uv-docker-example.tar
- name: Build and export (multistage)
uses: docker/build-push-action@v6
with:
file: multistage.Dockerfile
tags: uv-docker-example-multistage:latest
cache-from: type=gha,scope=uv-docker-example-multistage
cache-to: type=gha,mode=min,scope=uv-docker-example-multistage
outputs: type=docker,dest=/tmp/uv-docker-example-multistage.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: uv-docker-example
path: /tmp/uv-docker-example.tar
- name: Upload artifact (multistage)
uses: actions/upload-artifact@v4
with:
name: uv-docker-example-multistage
path: /tmp/uv-docker-example-multistage.tar
test:
name: "test image"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: uv-docker-example
path: /tmp
- name: Download artifact (multistage)
uses: actions/download-artifact@v4
with:
name: uv-docker-example-multistage
path: /tmp
- name: Load images
run: |
docker load --input /tmp/uv-docker-example.tar
docker load --input /tmp/uv-docker-example-multistage.tar
docker image ls -a
- name: Test command line
run: ./run.sh hello
- name: Test Docker compose
run: |
docker compose up --watch -d
docker compose down
- name: Test command line (multistage)
run: docker run uv-docker-example-multistage:latest hello