ci: deploy demo-app with local docker actions
Some checks failed
Docker Deploy / build-deploy (push) Failing after 0s

This commit is contained in:
Local CICD Bot
2026-04-28 11:52:00 +08:00
parent f7114f6c11
commit 22d9037ff5
2 changed files with 50 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
name: Docker Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-deploy:
runs-on: docker-cli
container:
image: docker:28-cli
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/d/docker:/mnt/d/docker
steps:
- name: Build Docker image
run: |
set -eu
apk add --no-cache git
rm -rf /tmp/demo-app-source
git clone /mnt/d/docker/gitea/data/git/gitea-repositories/admin/demo-app.git /tmp/demo-app-source
cd /tmp/demo-app-source
if [ -n "${GITHUB_SHA:-}" ]; then
git checkout "${GITHUB_SHA}"
fi
short_sha="$(git rev-parse --short=12 HEAD)"
docker build --pull=false -t "local/demo-app:ci-${short_sha}" -t local/demo-app:ci .
- name: Deploy with Docker Compose
run: |
set -eu
cd /mnt/d/docker/demo-app
docker compose up -d
- name: Verify container
run: |
set -eu
for i in $(seq 1 30); do
status="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' docker-demo-app 2>/dev/null || true)"
if [ "${status}" = "healthy" ] || [ "${status}" = "running" ]; then
docker run --rm --network edge-net curlimages/curl:8.11.1 -fsS http://docker-demo-app:8080/ >/dev/null
exit 0
fi
sleep 2
done
docker logs --tail 80 docker-demo-app || true
exit 1

View File

@@ -1,4 +1,4 @@
FROM 192.168.100.10:30003/library/python:3.11-alpine
FROM docker.m.daocloud.io/library/python:3.11-alpine
WORKDIR /app
COPY app.py .
EXPOSE 8080