mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 18:12:55 +01:00
Previously 19.0.3.1 would match multiple versions: ``` 5:19.03.11~3-0~debian-stretch 5:19.03.10~3-0~debian-stretch 5:19.03.1~3-0~debian-stretch ``` We can tighten up the regexp by adding a `~` to the end of the version.
27 lines
658 B
Bash
Executable file
27 lines
658 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -xeuo pipefail
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
DOCKER_VERSION=${1}
|
|
|
|
apt-get update
|
|
apt-get -y install \
|
|
apt-transport-https \
|
|
ca-certificates \
|
|
curl \
|
|
gnupg
|
|
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
|
|
|
|
|
|
echo "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" >> /etc/apt/sources.list.d/docker.list
|
|
apt-get update
|
|
|
|
PACKAGE_VERSION=$(apt-cache policy docker-ce | awk -v dv=${DOCKER_VERSION}~ '$1 ~ dv {print $1}')
|
|
|
|
apt-get install -y docker-ce=${PACKAGE_VERSION} docker-ce-cli=${PACKAGE_VERSION}
|
|
apt-get -yq autoremove
|
|
apt-get clean -yqq
|
|
rm -rf /var/lib/apt/lists/*
|