forked from AtalayaLabs/OxiCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·76 lines (61 loc) · 2.25 KB
/
Copy pathdocker-build.yml
File metadata and controls
executable file
·76 lines (61 loc) · 2.25 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
name: Docker Build and Test
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
jobs:
build-and-test:
name: Build and Test Docker Image
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: test/oxicloud
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: test/oxicloud:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Verify image starts correctly
run: |
# Start the container in background
docker run -d --name oxicloud-test \
-e DATABASE_URL="postgres://test:test@localhost/test" \
-p 8080:8080 \
test/oxicloud:test || true
# Give it a moment to start (or fail)
sleep 3
# Check that the container exists and show logs
echo "=== Container status ==="
docker ps -a --filter name=oxicloud-test
echo "=== Container logs ==="
docker logs oxicloud-test 2>&1 || true
# Cleanup
docker rm -f oxicloud-test || true
- name: Verify image structure
run: |
echo "=== Image size ==="
docker image ls test/oxicloud:test
echo "=== Binary exists and is executable ==="
docker run --rm --entrypoint sh test/oxicloud:test -c "test -x /usr/local/bin/oxicloud && echo 'OK: binary is executable'"
echo "=== Static files present ==="
docker run --rm --entrypoint sh test/oxicloud:test -c "ls /app/static/index.html && echo 'OK: static files present'"
echo "=== DB schema present ==="
docker run --rm --entrypoint sh test/oxicloud:test -c "ls /app/db/schema.sql && echo 'OK: schema present'"
echo "✅ Docker build and test completed successfully"