VOL-2006 update voltha-api-server to use go mod
Change-Id: Ic9cce461175dd08cc4f30ddda2172640e8928b00
diff --git a/docker/Dockerfile.afrouter b/docker/Dockerfile.afrouter
index 5df1e50..0046c19 100644
--- a/docker/Dockerfile.afrouter
+++ b/docker/Dockerfile.afrouter
@@ -27,25 +27,19 @@
protobuf-dev=3.6.1-r1
# Prepare directory structure
-RUN mkdir -p /build \
- "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
- "$GOPATH/src/github.com/opencord" \
- "$GOPATH/src/github.com/opencord/voltha-api-server"
+RUN mkdir -p /build/src/arouter \
+ "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin"
-WORKDIR $GOPATH/src/github.com/opencord/voltha-api-server
+WORKDIR /build/src/arouter
-# Copy vendor files.
-COPY vendor ./vendor
-
-# Copy api-server source files
-COPY internal ./internal
-COPY cmd ./cmd
+# Copy source
+COPY . .
# Copy config
COPY arouter.json /build
# Copy config and runtime protobuf needed for routing
-RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build
+RUN cp vendor/github.com/opencord/voltha-protos/voltha.pb /build
ARG org_label_schema_version=unknown
ARG org_label_schema_vcs_url=unknown
@@ -55,9 +49,8 @@
ARG org_opencord_vcs_dirty=unknown
# Build
-WORKDIR $GOPATH/src/github.com/opencord/voltha-api-server
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
-RUN go build -o /build/afrouter \
+RUN go build -mod=vendor -o /build/afrouter \
-ldflags \
"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
-X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref \
diff --git a/docker/Dockerfile.afrouterd b/docker/Dockerfile.afrouterd
index 91cf4fd..e8d3487 100644
--- a/docker/Dockerfile.afrouterd
+++ b/docker/Dockerfile.afrouterd
@@ -27,19 +27,14 @@
protobuf-dev=3.6.1-r1
# Prepare directory structure
-RUN mkdir -p /build \
- "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
- "$GOPATH/src/github.com/opencord" \
- "$GOPATH/src/github.com/opencord/voltha-api-server"
+RUN mkdir -p /build/src/arouterd \
+ "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin"
-WORKDIR $GOPATH/src/github.com/opencord/voltha-api-server
-# Copy common files.
-COPY vendor ./vendor
+WORKDIR /build/src/arouterd
-# Copy files
-COPY internal ./internal
-COPY cmd ./cmd
+# Copy source
+COPY . .
# Copy config
COPY arouter.json /build
@@ -52,9 +47,8 @@
ARG org_opencord_vcs_dirty=unknown
# Build
-WORKDIR $GOPATH/src/github.com/opencord/voltha-api-server
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
-RUN go build -o /build/arouterd \
+RUN go build -mod=vendor -o /build/arouterd \
-ldflags \
"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
-X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref \