├── Dockerfile ├── README.md ├── get-versions └── LICENSE /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | ADD get-versions /usr/bin/get-versions 3 | RUN chmod +x /usr/bin/get-versions 4 | ENTRYPOINT ["/usr/bin/get-versions"] 5 | CMD ["bash"] 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # get-versions 2 | A docker image that outputs a RUN instruction documenting the specific version dependencies for a package 3 | 4 | See [here](https://zwischenzugs.wordpress.com/2015/02/21/fight-docker-package-drift/) 5 | 6 | -------------------------------------------------------------------------------- /get-versions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | for c in apt-get apt-cache 6 | do 7 | if [ $(which $c | wc -c) = 0 ] 8 | then 9 | echo "Could not find ${c} command on path. Is this a debian-based distro?" 10 | exit 1 11 | fi 12 | done 13 | 14 | PKG=${1:?"please supply package name"} 15 | 16 | apt-get install -y -q $PKG > /dev/null 2>&1 17 | 18 | cat <(apt-cache --recurse --no-pre-depends --no-recommends --no-suggests --no-enhances --no-conflicts --no-breaks --no-replaces depends $PKG) <(echo $PKG) | grep "^[a-z]" | xargs apt-cache show | grep ^Package | sed 's/^Package: \(.*\)/dpkg -l \1 | grep ^ii | awk "{print \\$2,\\$3}"/g' | sh 2>/dev/null | sed 's/\(.*\) \(.*\)/\1=\2/' | tr '\n' ' ' | sed 's/^/RUN apt-get install -y /g' 19 | 20 | echo "" 21 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ian Miell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | --------------------------------------------------------------------------------