Working service that accepts a POST REST call with params and responds with config-file JSON
Change-Id: I70ac908c92c290d95c6373073184171673d86dc5
Signed-off-by: gunjan5 <gupatel@ciena.com>
diff --git a/config-generator/Dockerfile b/config-generator/Dockerfile
index 2d655b9..538ed40 100644
--- a/config-generator/Dockerfile
+++ b/config-generator/Dockerfile
@@ -11,30 +11,31 @@
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
-FROM ubuntu:14.04
+FROM golang:alpine
+
MAINTAINER Open Networking Labratory <info@onlab.us>
-RUN apt-get update && apt-get install --no-install-recommends -y \
- ca-certificates \
- curl \
- mercurial \
- git-core
-RUN curl -s https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz | tar -v -C /usr/local -xz
+RUN apk --update add git
-ENV GOPATH /go
-ENV GOROOT /usr/local/go
-ENV PATH /usr/local/go/bin:/go/bin:/usr/local/bin:$PATH
+# install godep
+WORKDIR /go
+RUN go get github.com/tools/godep
+ADD . /go/src/gerrit.opencord.org/maas/config-generator
-WORKDIR /app
+# restore dependancies
+WORKDIR /go/src/gerrit.opencord.org/maas/config-generator
+RUN /go/bin/godep restore || true
-# copy binary into image
-COPY app /app/
-COPY hosts.tpl /app/
-COPY links.tpl /app/
-COPY ports.tpl /app/
-COPY devices.tpl /app/
+# generate the binary
+WORKDIR /go/
+RUN go install gerrit.opencord.org/maas/config-generator
-VOLUME /app
+# copy templates to the image
+COPY hosts.tpl /go/bin/
+COPY links.tpl /go/bin/
+COPY ports.tpl /go/bin/
+COPY devices.tpl /go/bin/
+EXPOSE 1337
-# ENTRYPOINT ["./app"]
+ENTRYPOINT ["/go/bin/config-generator"]