From 43e119b26f0090e8a9e3eae95fd39e2e852add1f Mon Sep 17 00:00:00 2001 From: Raoul Millais Date: Fri, 31 Jan 2020 18:54:35 +0000 Subject: [PATCH] fix(build): only add needed files for golang build - This fix should prevent golang rebuilds when files other than go files change --- Dockerfile | 10 ++++++++-- Makefile | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cac84f95..88f1af71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -157,7 +157,13 @@ USER ${build_user} WORKDIR /go/src/github.com/controlplaneio/simulator-standalone # Add the full source tree -COPY --chown=1000 . /go/src/github.com/controlplaneio/simulator-standalone/ +COPY --chown=1000 Makefile /go/src/github.com/controlplaneio/simulator-standalone/ +COPY --chown=1000 prelude.mk /go/src/github.com/controlplaneio/simulator-standalone/ +COPY --chown=1000 main.go /go/src/github.com/controlplaneio/simulator-standalone/ +COPY --chown=1000 pkg/ /go/src/github.com/controlplaneio/simulator-standalone/pkg +COPY --chown=1000 cmd/ /go/src/github.com/controlplaneio/simulator-standalone/cmd +COPY --chown=1000 test/ /go/src/github.com/controlplaneio/simulator-standalone/test + WORKDIR /go/src/github.com/controlplaneio/simulator-standalone/ # TODO: (rem) why is this owned by root after the earlier chmod? @@ -205,7 +211,7 @@ RUN tar -C /usr/local -xzf go*.linux-amd64.tar.gz \ ENV PATH $PATH:/usr/local/go/bin # Add login message -COPY --from=build-and-test /go/src/github.com/controlplaneio/simulator-standalone/scripts/launch-motd /usr/local/bin/launch-motd +COPY ./scripts/launch-motd /usr/local/bin/launch-motd RUN echo '[ ! -z "$TERM" ] && source /usr/local/bin/launch-motd' >> /etc/bash.bashrc # Use 3rd party dependencies from build diff --git a/Makefile b/Makefile index e25826dd..486884dc 100644 --- a/Makefile +++ b/Makefile @@ -121,6 +121,7 @@ dep: go.mod ## Install dependencies for other targets .PHONY: static-analysis static-analysis: dep + ls -al golangci-lint run .PHONY: build