-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (69 loc) · 2 KB
/
Copy pathdocker.yml
File metadata and controls
78 lines (69 loc) · 2 KB
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
name: Build and Publish Image
on:
push:
branches: [main]
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/thehapyone/code-interpreter
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,format=short
type=ref,event=tag
- name: Build image for health check
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
load: true
tags: code-interpreter:local
build-args: |
APP_UID=1000
APP_GID=1000
- name: Health check
run: |
set -euo pipefail
docker run -d --rm -p 8000:8000 --name code-interpreter-smoke code-interpreter:local
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:8000/health >/dev/null; then
echo "Health check passed";
docker stop code-interpreter-smoke
exit 0
fi
echo "Waiting for container... ($i/30)"
sleep 1
done
docker logs code-interpreter-smoke || true
docker stop code-interpreter-smoke || true
exit 1
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APP_UID=1000
APP_GID=1000