Skip to content

Commit

Permalink
Used version() to validate docker version
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhav Thali <[email protected]>
  • Loading branch information
prabhav-thali committed Jun 12, 2020
1 parent b970b3b commit cf3297a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# Dockerfile defines che-machine-exec production image eclipse/che-machine-exec-dev
#
FROM --platform=$TARGETPLATFORM golang:1.12.8-alpine as go_builder
FROM golang:1.12.8-alpine as go_builder

ENV USER=machine-exec
ENV UID=12345
Expand All @@ -37,7 +37,7 @@ WORKDIR /che-machine-exec/
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags '-w -s' -a -installsuffix cgo -o /go/bin/che-machine-exec .

FROM --platform=$TARGETPLATFORM node:10.16-alpine as cloud_shell_builder
FROM node:10.16-alpine as cloud_shell_builder
COPY --from=go_builder /che-machine-exec/cloud-shell cloud-shell-src
WORKDIR cloud-shell-src
RUN yarn && \
Expand Down
11 changes: 6 additions & 5 deletions cico_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ function load_jenkins_vars() {
}

function check_buildx_support() {
export DOCKER_BUILD_KIT=1
export DOCKER_CLI_EXPERIMENTAL=enabled

docker_version="$(docker --version | cut -d' ' -f3 | tr -cd '0-9.')"
if [[ $docker_version < 19.03 ]]; then
echo "CICO: Docker $docker_version greater than or equal to 19.03 is required."
if [[ "$(version "$docker_version")" < "$(version '19.03')" ]]; then
echo "CICO: Docker $docker_version is too old. Greater than or equal to 19.03 is required."
exit 1
fi

Expand All @@ -66,6 +63,10 @@ function install_deps() {

service docker start

#set buildx env
export DOCKER_BUILD_KIT=1
export DOCKER_CLI_EXPERIMENTAL=enabled

#Enable qemu and binfmt support
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Expand Down

0 comments on commit cf3297a

Please sign in to comment.