2020-01-29 05:23:02 -05:00
|
|
|
ARG GO_VERSION=1.12.16
|
2019-07-18 05:13:45 -04:00
|
|
|
|
|
|
|
FROM golang:${GO_VERSION}-alpine
|
2017-04-18 19:12:24 -04:00
|
|
|
|
2018-03-06 05:15:18 -05:00
|
|
|
RUN apk add -U git make bash coreutils ca-certificates curl
|
2017-04-18 19:12:24 -04:00
|
|
|
|
2020-02-12 06:48:24 -05:00
|
|
|
# v0.1.1
|
|
|
|
ARG VNDR_SHA=85886e1ac99b8d96590e6e0d9f075dc7a711d132
|
2017-07-18 12:22:28 -04:00
|
|
|
RUN go get -d github.com/LK4D4/vndr && \
|
2017-07-11 14:19:02 -04:00
|
|
|
cd /go/src/github.com/LK4D4/vndr && \
|
|
|
|
git checkout -q "$VNDR_SHA" && \
|
2017-07-10 17:31:57 -04:00
|
|
|
go build -v -o /usr/bin/vndr . && \
|
2017-04-18 19:12:24 -04:00
|
|
|
rm -rf /go/src/* /go/pkg/* /go/bin/*
|
|
|
|
|
2020-01-20 10:22:37 -05:00
|
|
|
# v0.2.0
|
|
|
|
ARG ESC_SHA=0ea7db170df78dcddf3e223365f444163147fe89
|
2018-02-12 13:03:31 -05:00
|
|
|
RUN go get -d github.com/mjibson/esc && \
|
|
|
|
cd /go/src/github.com/mjibson/esc && \
|
|
|
|
git checkout -q "$ESC_SHA" && \
|
|
|
|
go build -v -o /usr/bin/esc . && \
|
2017-05-09 15:37:22 -04:00
|
|
|
rm -rf /go/src/* /go/pkg/* /go/bin/*
|
|
|
|
|
2020-01-27 11:48:01 -05:00
|
|
|
ARG GOTESTSUM_VERSION=0.4.0
|
2019-01-24 11:53:42 -05:00
|
|
|
RUN curl -Ls https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_linux_amd64.tar.gz -o gotestsum.tar.gz && \
|
|
|
|
tar -xf gotestsum.tar.gz gotestsum -C /usr/bin && \
|
|
|
|
rm gotestsum.tar.gz
|
|
|
|
|
2017-08-04 21:24:21 -04:00
|
|
|
ENV CGO_ENABLED=0 \
|
2017-08-15 14:32:44 -04:00
|
|
|
PATH=$PATH:/go/src/github.com/docker/cli/build \
|
|
|
|
DISABLE_WARN_OUTSIDE_CONTAINER=1
|
2017-04-18 19:12:24 -04:00
|
|
|
WORKDIR /go/src/github.com/docker/cli
|
|
|
|
CMD sh
|
Do not patch Dockerfiles in CI
When building the Dockerfiles for development, those images are mainly used to
create a reproducible build-environment. The source code is bind-mounted into
the image at runtime; there is no need to create an image with the actual
source code, and copying the source code into the image would lead to a new
image being created for each code-change (possibly leading up to many "dangling"
images for previous code-changes).
However, when building (and using) the development images in CI, bind-mounting
is not an option, because the daemon is running remotely.
To make this work, the circle-ci script patched the Dockerfiles when CI is run;
adding a `COPY` to the respective Dockerfiles.
Patching Dockerfiles is not really a "best practice" and, even though the source
code does not and up in the image, the source would still be _sent_ to the daemon
for each build (unless BuildKit is used).
This patch updates the makefiles, circle-ci script, and Dockerfiles;
- When building the Dockerfiles locally, pipe the Dockerfile through stdin.
Doing so, prevents the build-context from being sent to the daemon. This speeds
up the build, and doesn't fill up the Docker "temp" directory with content that's
not used
- Now that no content is sent, add the COPY instructions to the Dockerfiles, and
remove the code in the circle-ci script to "live patch" the Dockerfiles.
Before this patch is applied (with cache):
```
$ time make -f docker.Makefile build_shell_validate_image
docker build -t docker-cli-shell-validate -f ./dockerfiles/Dockerfile.shellcheck .
Sending build context to Docker daemon 41MB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
2.75 real 0.45 user 0.56 sys
```
After this patch is applied (with cache)::
```
$ time make -f docker.Makefile build_shell_validate_image
cat ./dockerfiles/Dockerfile.shellcheck | docker build -t docker-cli-shell-validate -
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM debian:stretch-slim
...
Successfully built 81e14e8ad856
Successfully tagged docker-cli-shell-validate:latest
0.33 real 0.07 user 0.08 sys
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-28 19:06:10 -05:00
|
|
|
COPY . .
|