Skip to content

Instantly share code, notes, and snippets.

View melboyce's full-sized avatar
💖
🦄

Mel Boyce melboyce

💖
🦄
View GitHub Profile
@melboyce
melboyce / get-latest-alpine.sh
Last active August 9, 2019 11:11
bash: latest Docker semver tag for image
#!/usr/bin/env bash
die() { echo "${1:-hurts}" >&2; exit "${2:-1}"; }
hash jq 2>/dev/null || die "missing dep: jq"
curl -s https://registry.hub.docker.com/v1/repositories/alpine/tags \
| jq -r '.[].name' \
| grep -E '^[0-9]+\.[0-9]+(\..+)?$' \
| sort -t. -k1,1n -k2,2n -k3,3n \
| tail -n1
/*
* Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright