ci: build and run a test Docker image

This commit is contained in:
Codex Test
2026-07-29 17:25:58 +08:00
parent 52a543c855
commit f11cca1860
4 changed files with 39 additions and 1 deletions
+3
View File
@@ -0,0 +1,3 @@
.git
.gitea
codex-ssh-test.md
+14 -1
View File
@@ -8,6 +8,9 @@ jobs:
image: ubuntu:latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Say Hello
run: echo "Testing connection..."
@@ -31,4 +34,14 @@ jobs:
echo "正在嘗試連線 Docker API..."
echo "DOCKER_HOST = $DOCKER_HOST"
docker ps
echo "成功!可以看到上面的容器列表了!"
echo "成功!可以看到上面的容器列表了!"
- name: Build Test Image
run: |
docker build --progress=plain -t test-runner:ci .
- name: Run Test Image
run: |
output="$(docker run --rm test-runner:ci)"
echo "$output"
test "$output" = "Gitea Runner Docker build succeeded."
+15
View File
@@ -0,0 +1,15 @@
FROM alpine:3.22.5 AS builder
RUN apk add --no-cache build-base
WORKDIR /src
COPY hello.c .
RUN mkdir -p /out \
&& cc -O2 -Wall -Wextra -Werror -static hello.c -o /out/hello
FROM scratch
COPY --from=builder /out/hello /hello
ENTRYPOINT ["/hello"]
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
int main(void)
{
puts("Gitea Runner Docker build succeeded.");
return 0;
}