Enforce container name limit and update appstore push workflow
This commit is contained in:
@@ -16,6 +16,7 @@ Fokus: korrekthet, låg risk och underhållbarhet.
|
|||||||
- `docker-compose.yaml`
|
- `docker-compose.yaml`
|
||||||
- `README.md` (syfte, portar, volymer, privilegier, risker)
|
- `README.md` (syfte, portar, volymer, privilegier, risker)
|
||||||
- Compose ska ha giltig top-level `name` (gemener + bindestreck).
|
- Compose ska ha giltig top-level `name` (gemener + bindestreck).
|
||||||
|
- Om `container_name` används måste den vara max 32 tecken och bara innehålla `0-9`, `a-z`, `A-Z`, `_`, `-`.
|
||||||
- Endast `.yaml` används i repot (aldrig `.yml`).
|
- Endast `.yaml` används i repot (aldrig `.yml`).
|
||||||
|
|
||||||
## 3) Säkerhetsbaseline (Compose)
|
## 3) Säkerhetsbaseline (Compose)
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ docker inspect docker-ip-addr-manager | jq '.[0].Config.Env'
|
|||||||
```bash
|
```bash
|
||||||
docker logs --tail 200 docker-ip-addr-manager
|
docker logs --tail 200 docker-ip-addr-manager
|
||||||
|
|
||||||
docker logs --tail 200 docker-ip-addr-manager-socket-proxy
|
docker logs --tail 200 docker-ip-addr-manager-proxy
|
||||||
```
|
```
|
||||||
|
|
||||||
- Konkreta felobservationer:
|
- Konkreta felobservationer:
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ services:
|
|||||||
|
|
||||||
socket-proxy:
|
socket-proxy:
|
||||||
image: lscr.io/linuxserver/socket-proxy:version-24.02.26
|
image: lscr.io/linuxserver/socket-proxy:version-24.02.26
|
||||||
container_name: docker-ip-addr-manager-socket-proxy
|
container_name: docker-ip-addr-manager-proxy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
TZ: Europe/Stockholm
|
TZ: Europe/Stockholm
|
||||||
|
|||||||
@@ -2,21 +2,49 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
output_dir="${1:-$repo_root/dist}"
|
push_mode=0
|
||||||
#zip_name="${2:-zima-appstore-$(date +%Y%m%d-%H%M%S).zip}"
|
positional=()
|
||||||
zip_name="${2:-phirna-appstore.zip}"
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--push)
|
||||||
|
push_mode=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
# handled below via usage
|
||||||
|
positional+=("$1")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
positional+=("$1")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ${#positional[@]} -gt 2 ]]; then
|
||||||
|
echo "ERROR: too many arguments"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
output_dir="${positional[0]:-$repo_root/dist}"
|
||||||
|
#zip_name="${positional[1]:-zima-appstore-$(date +%Y%m%d-%H%M%S).zip}"
|
||||||
|
zip_name="${positional[1]:-phirna-appstore.zip}"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<USAGE
|
cat <<USAGE
|
||||||
Usage: $0 [output_dir] [zip_name]
|
Usage: $0 [output_dir] [zip_name]
|
||||||
|
$0 --push [output_dir] [zip_name]
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
$0
|
$0
|
||||||
$0 ./dist zima-apps-main.zip
|
$0 ./dist zima-apps-main.zip
|
||||||
|
$0 --push
|
||||||
USAGE
|
USAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
if [[ "${positional[0]:-}" == "-h" || "${positional[0]:-}" == "--help" ]]; then
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -111,3 +139,22 @@ if command -v shasum >/dev/null 2>&1; then
|
|||||||
else
|
else
|
||||||
echo "ZIP created: $zip_path"
|
echo "ZIP created: $zip_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$push_mode" -eq 1 ]]; then
|
||||||
|
if [[ "$is_git_repo" -ne 1 ]]; then
|
||||||
|
echo "ERROR: --push requires a git repository"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Push mode enabled: switching to main and publishing dist/"
|
||||||
|
git -C "$repo_root" checkout main
|
||||||
|
git -C "$repo_root" add dist/
|
||||||
|
|
||||||
|
if git -C "$repo_root" diff --cached --quiet; then
|
||||||
|
echo "No staged changes in dist/. Nothing to commit."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git -C "$repo_root" commit -m "Updated appstore"
|
||||||
|
git -C "$repo_root" push origin main
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user