Skip to content

Commit

Permalink
Use official shellcheck image
Browse files Browse the repository at this point in the history
This patch switches the shellcheck image to use the official image
from Docker Hub. In order to keep the image minimal, the validate/shellcheck
script is called directly (so that `make` is not needed), and is now using
`/bin/sh` instead of `bash` (which wasn't needed to perform the checks).

Note that this does not yet update shellcheck to the latest version, because
checks fail with the v0.5 version. Instead, the latest v0.4.x version is used,
which is roughly the same version as was installed in the image before this
change;

```
docker run --rm docker-cli-shell-validate shellcheck --version
ShellCheck - shell script analysis tool
version: 0.4.4
license: GNU General Public License, version 3
website: http://www.shellcheck.net
```

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Nov 29, 2018
1 parent 866c837 commit 0077c51
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docker.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ yamldocs: build_docker_image ## generate documentation YAML files consumed by do

.PHONY: shellcheck
shellcheck: build_shell_validate_image ## run shellcheck validation
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(VALIDATE_IMAGE_NAME) make shellcheck
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(VALIDATE_IMAGE_NAME) scripts/validate/shellcheck

.PHONY: test-e2e ## run e2e tests
test-e2e: test-e2e-non-experimental test-e2e-experimental test-e2e-connhelper-ssh
Expand Down
10 changes: 1 addition & 9 deletions dockerfiles/Dockerfile.shellcheck
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
FROM debian:stretch-slim

RUN apt-get update && \
apt-get -y install make shellcheck && \
apt-get clean

FROM koalaman/shellcheck-alpine:v0.4.7
WORKDIR /go/src/github.com/docker/cli
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
CMD bash
COPY . .
2 changes: 1 addition & 1 deletion scripts/validate/shellcheck
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
set -eo pipefail

shellcheck contrib/completion/bash/docker
Expand Down

0 comments on commit 0077c51

Please sign in to comment.