Move ARGs to prevent invalidating docker caches
Having the ARG at the top of the dockerfiles
cause all the cached layers below to be invalidated
resulting in needlessly re-downloading or re-copying
files
Change-Id: Ie701b1556ee21ecdcf629e06c9b26d80af0fb344
diff --git a/docker/Dockerfile.afrouter b/docker/Dockerfile.afrouter
index 04cbf4c..40b5423 100644
--- a/docker/Dockerfile.afrouter
+++ b/docker/Dockerfile.afrouter
@@ -17,13 +17,6 @@
FROM golang:1.12-alpine3.9 AS build-env
-ARG org_label_schema_version=unknown
-ARG org_label_schema_vcs_url=unknown
-ARG org_label_schema_vcs_ref=unknown
-ARG org_label_schema_build_date=unknown
-ARG org_opencord_vcs_commit_date=unknown
-ARG org_opencord_vcs_dirty=unknown
-
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
@@ -49,6 +42,13 @@
RUN cp afrouter/arouter.json /build
RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_vcs_dirty=unknown
+
# Build
RUN cd afrouter && go build -o /build/afrouter \
-ldflags \
diff --git a/docker/Dockerfile.afrouterTest b/docker/Dockerfile.afrouterTest
index 33c6d46..5500156 100644
--- a/docker/Dockerfile.afrouterTest
+++ b/docker/Dockerfile.afrouterTest
@@ -17,13 +17,6 @@
FROM golang:1.12-alpine3.9 AS build-env
-ARG org_label_schema_version=unknown
-ARG org_label_schema_vcs_url=unknown
-ARG org_label_schema_vcs_ref=unknown
-ARG org_label_schema_build_date=unknown
-ARG org_opencord_vcs_commit_date=unknown
-ARG org_opencord_vcs_dirty=unknown
-
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
@@ -54,6 +47,13 @@
RUN cp afrouter/arouter.json /build/tests/suites/
RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build/tests/suites/
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_vcs_dirty=unknown
+
# Build
RUN cd afrouter && go build --tags integration -o /build/afrouter \
-ldflags \
diff --git a/docker/Dockerfile.afrouterd b/docker/Dockerfile.afrouterd
index 6778b7b..6401b24 100644
--- a/docker/Dockerfile.afrouterd
+++ b/docker/Dockerfile.afrouterd
@@ -17,13 +17,6 @@
FROM golang:1.12-alpine3.9 AS build-env
-ARG org_label_schema_version=unknown
-ARG org_label_schema_vcs_url=unknown
-ARG org_label_schema_vcs_ref=unknown
-ARG org_label_schema_build_date=unknown
-ARG org_opencord_vcs_commit_date=unknown
-ARG org_opencord_vcs_dirty=unknown
-
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
@@ -49,6 +42,13 @@
# Copy config
RUN cp afrouter/arouter.json /build
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_vcs_dirty=unknown
+
# Build
RUN cd arouterd && go build -o /build/arouterd \
-ldflags \
diff --git a/docker/Dockerfile.ro_core b/docker/Dockerfile.ro_core
index 5b41c89..1fbabe0 100644
--- a/docker/Dockerfile.ro_core
+++ b/docker/Dockerfile.ro_core
@@ -17,13 +17,6 @@
FROM golang:1.12-alpine3.9 AS build-env
-ARG org_label_schema_version=unknown
-ARG org_label_schema_vcs_url=unknown
-ARG org_label_schema_vcs_ref=unknown
-ARG org_label_schema_build_date=unknown
-ARG org_opencord_vcs_commit_date=unknown
-ARG org_opencord_vcs_dirty=unknown
-
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
@@ -44,6 +37,13 @@
# Copy files.
COPY ro_core ./ro_core
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_vcs_dirty=unknown
+
# Build
RUN cd ro_core && go build -o /build/ro_core \
-ldflags \
diff --git a/docker/Dockerfile.rw_core b/docker/Dockerfile.rw_core
index 71996be..96c7679 100644
--- a/docker/Dockerfile.rw_core
+++ b/docker/Dockerfile.rw_core
@@ -17,13 +17,6 @@
FROM golang:1.12-alpine3.9 AS build-env
-ARG org_label_schema_version=unknown
-ARG org_label_schema_vcs_url=unknown
-ARG org_label_schema_vcs_ref=unknown
-ARG org_label_schema_build_date=unknown
-ARG org_opencord_vcs_commit_date=unknown
-ARG org_opencord_vcs_dirty=unknown
-
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
@@ -44,6 +37,13 @@
# Copy files
COPY rw_core ./rw_core
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_vcs_dirty=unknown
+
# Build
RUN cd rw_core && go build -o /build/rw_core \
-ldflags \
diff --git a/docker/Dockerfile.simulated_olt b/docker/Dockerfile.simulated_olt
index 6904318..2cf9ba2 100644
--- a/docker/Dockerfile.simulated_olt
+++ b/docker/Dockerfile.simulated_olt
@@ -17,13 +17,6 @@
FROM golang:1.12-alpine3.9 AS build-env
-ARG org_label_schema_version=unknown
-ARG org_label_schema_vcs_url=unknown
-ARG org_label_schema_vcs_ref=unknown
-ARG org_label_schema_build_date=unknown
-ARG org_opencord_vcs_commit_date=unknown
-ARG org_opencord_vcs_dirty=unknown
-
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
@@ -46,6 +39,13 @@
COPY adapters/common ./adapters/common
COPY adapters/*.go ./adapters/
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_vcs_dirty=unknown
+
# Build
RUN cd adapters/simulated_olt && go build -o /build/simulated_olt \
-ldflags \
diff --git a/docker/Dockerfile.simulated_onu b/docker/Dockerfile.simulated_onu
index 921fc2a..911bd4d 100644
--- a/docker/Dockerfile.simulated_onu
+++ b/docker/Dockerfile.simulated_onu
@@ -17,13 +17,6 @@
FROM golang:1.12-alpine3.9 AS build-env
-ARG org_label_schema_version=unknown
-ARG org_label_schema_vcs_url=unknown
-ARG org_label_schema_vcs_ref=unknown
-ARG org_label_schema_build_date=unknown
-ARG org_opencord_vcs_commit_date=unknown
-ARG org_opencord_vcs_dirty=unknown
-
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
@@ -46,6 +39,13 @@
COPY adapters/common ./adapters/common
COPY adapters/*.go ./adapters/
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_vcs_dirty=unknown
+
# Build
RUN cd adapters/simulated_onu && go build -o /build/simulated_onu \
-ldflags \