Add Dockerfile, compose file and Gitea Actions workflow
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8341c25846
commit
b0480c8e56
5 files changed
+104
-12
No files matched your search
@@ -0,0 +1,47 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
REGISTRY: git.necloud.us
|
||||
IMAGE: git.necloud.us/nate/audiobook-player
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Syntax check
|
||||
run: python3 -m py_compile server.py
|
||||
- name: Check the page script parses
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import re
|
||||
open("/tmp/page.js", "w").write(re.search(r"<script>(.*)</script>", open("index.html").read(), re.S).group(1))
|
||||
PY
|
||||
node --check /tmp/page.js
|
||||
|
||||
image:
|
||||
needs: check
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
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
|
||||
run: docker build -t "$IMAGE:${{ gitea.sha }}" -t "$IMAGE:latest" .
|
||||
- name: Smoke test (server refuses to start without accounts, but must import and print usage)
|
||||
run: docker run --rm "$IMAGE:latest" python server.py users
|
||||
- name: Push
|
||||
run: |
|
||||
docker push "$IMAGE:${{ gitea.sha }}"
|
||||
docker push "$IMAGE:latest"
|
||||
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