Statement loader web app with Docker image and Gitea Actions build
build-container / build (push) Successful in 31s
build-container / build (push) Successful in 31s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
3dba054dca
12 files changed
+1081
No files matched your search
@@ -0,0 +1,47 @@
|
||||
name: build-container
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: git.necloud.us
|
||||
IMAGE: git.necloud.us/nate/money
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest # runner needs Docker access (act_runner with the docker socket)
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Gitea container registry
|
||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ gitea.actor }}" --password-stdin
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build \
|
||||
--label org.opencontainers.image.source="${{ gitea.server_url }}/${{ gitea.repository }}" \
|
||||
--label org.opencontainers.image.revision="${{ gitea.sha }}" \
|
||||
-t "$IMAGE:latest" -t "$IMAGE:${{ gitea.sha }}" .
|
||||
|
||||
- name: Smoke test (starts the app and loads the dashboard page)
|
||||
run: |
|
||||
docker run -d --name smoke "$IMAGE:latest"
|
||||
for i in $(seq 1 20); do
|
||||
docker exec smoke python -c "import urllib.request;urllib.request.urlopen('http://127.0.0.1:8765/dashboard')" && ok=1 && break
|
||||
sleep 1
|
||||
done
|
||||
docker logs smoke
|
||||
docker rm -f smoke
|
||||
test "$ok" = 1
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
docker push "$IMAGE:latest"
|
||||
docker push "$IMAGE:${{ gitea.sha }}"
|
||||
if [ "${{ gitea.ref_type }}" = "tag" ]; then
|
||||
docker tag "$IMAGE:latest" "$IMAGE:${{ gitea.ref_name }}"
|
||||
docker push "$IMAGE:${{ gitea.ref_name }}"
|
||||
fi
|
||||
Reference in new issue
Block a user