update vaultwarden config and add a alias to alias file
This commit is contained in:
@@ -16,3 +16,48 @@ alias hugo-rebuild='rm -rf public/ && hugo server --appendPort=false --baseURL="
|
|||||||
# helpers for quickly editing aliases
|
# helpers for quickly editing aliases
|
||||||
alias src='source ~/.bash_aliases'
|
alias src='source ~/.bash_aliases'
|
||||||
alias edit='vim /srv/configs/.bash_aliases'
|
alias edit='vim /srv/configs/.bash_aliases'
|
||||||
|
|
||||||
|
# Docker Image Version Tag checker
|
||||||
|
function _tagger() {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: tag <image>:<tag>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split image and tag safely
|
||||||
|
local INPUT="$1"
|
||||||
|
local REPO="${INPUT%%:*}"
|
||||||
|
local TAG="${INPUT##*:}"
|
||||||
|
|
||||||
|
# If no tag provided, default to latest
|
||||||
|
[ "$REPO" = "$TAG" ] && TAG="latest"
|
||||||
|
|
||||||
|
# Handle official library images
|
||||||
|
local API_REPO="$REPO"
|
||||||
|
[[ "$REPO" != *"/"* ]] && API_REPO="library/$REPO"
|
||||||
|
|
||||||
|
# 1. Grab the exact unique digest for the target tag
|
||||||
|
local DIGEST
|
||||||
|
DIGEST=$(curl -s "https://hub.docker.com/v2/repositories/${API_REPO}/tags/${TAG}" | jq -r '.digest // empty')
|
||||||
|
|
||||||
|
if [ -z "$DIGEST" ] || [ "$DIGEST" = "null" ]; then
|
||||||
|
echo "Error: Image or tag not found on Docker Hub."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Get the sibling tag sharing the same digest, skipping text labels
|
||||||
|
local VERSION
|
||||||
|
VERSION=$(curl -s "https://hub.docker.com/v2/repositories/${API_REPO}/tags/?page_size=100" \
|
||||||
|
| jq -r --arg dig "$DIGEST" \
|
||||||
|
'.results[] | select(.digest == $dig) | .name' \
|
||||||
|
| grep -E -v 'latest|alpine|slim|debian|bullseye|bookworm|ubuntu|test|rc|nightly' \
|
||||||
|
| head -n 1)
|
||||||
|
|
||||||
|
# 3. Output results
|
||||||
|
if [ -n "$VERSION" ]; then
|
||||||
|
echo "${REPO}:${VERSION}"
|
||||||
|
else
|
||||||
|
echo "${REPO}:${TAG}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
alias tag='_tagger'
|
||||||
@@ -2,18 +2,19 @@
|
|||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
vaultwarden:
|
vaultwarden:
|
||||||
image: vaultwarden/server:1.35.2
|
image: vaultwarden/server:1.36.0
|
||||||
container_name: vaultwarden
|
container_name: vaultwarden
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
DOMAIN: "${VAULT_DOMAIN}"
|
DOMAIN: "${VAULT_DOMAIN}"
|
||||||
ROCKET_PORT: ${ROCKET_PORT}
|
ROCKET_PORT: ${ROCKET_PORT}
|
||||||
ROCKET_ENV: production
|
ROCKET_ENV: production
|
||||||
|
ADMIN_TOKEN: ${ADMIN_TOKEN}
|
||||||
volumes:
|
volumes:
|
||||||
- vaultwarden-mount:/data/
|
- vaultwarden-mount:/data/
|
||||||
ports:
|
ports:
|
||||||
- 'LOCAL_PORT:80'
|
- '${LOCAL_PORT}:80'
|
||||||
- 'SSL_PORT:443'
|
- '${SSL_PORT}:443'
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
vaultwarden-mount:
|
vaultwarden-mount:
|
||||||
|
|||||||
Reference in New Issue
Block a user