Commit dcd804ac authored by jackgr's avatar jackgr

Fix expandybird build.

parent 7655c0a3
...@@ -275,7 +275,7 @@ func callService(path, method, action string, reader io.ReadCloser) { ...@@ -275,7 +275,7 @@ func callService(path, method, action string, reader io.ReadCloser) {
panic(fmt.Errorf("cannot parse url (%s): %s\n", path, err)) panic(fmt.Errorf("cannot parse url (%s): %s\n", path, err))
} }
URL.Path += path URL.Path = strings.TrimRight(URL.Path, "/") + "/" + strings.TrimLeft(path, "/")
resp := callHTTP(URL.String(), method, action, reader) resp := callHTTP(URL.String(), method, action, reader)
var j interface{} var j interface{}
if err := json.Unmarshal([]byte(resp), &j); err != nil { if err := json.Unmarshal([]byte(resp), &j); err != nil {
......
FROM python:2-onbuild # Copyright 2015 Google, Inc. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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 python:2
MAINTAINER Jack Greenfield <jackgr@google.com>
RUN ln -s /usr/local/bin/python /usr/bin/python RUN ln -s /usr/local/bin/python /usr/bin/python
RUN apt-get update \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# following lines copied from golang:1.4
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
&& rm -rf /var/lib/apt/lists/*
ENV GOLANG_VERSION 1.4.3
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
ENV GOLANG_DOWNLOAD_SHA1 486db10dc571a55c8d795365070f66d343458c48
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA1 golang.tar.gz" | sha1sum -c - \
&& tar -C /usr/src -xzf golang.tar.gz \
&& rm golang.tar.gz \
&& cd /usr/src/go/src && ./make.bash --no-clean 2>&1
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/src/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
#end copied lines
COPY . "$GOPATH"/src/github.com/kubernetes/deployment-manager
WORKDIR "$GOPATH"/src/github.com/kubernetes/deployment-manager/expandybird
RUN go get -v -d .
RUN go install -v .
RUN mkdir -p /var/expandybird/expansion RUN mkdir -p /var/expandybird/expansion
WORKDIR /var/expandybird WORKDIR /var/expandybird
ADD expandybird ./expandybird COPY ./expandybird/expansion /var/expandybird/expansion
ADD expansion ./expansion
COPY ./expandybird/requirements.txt /var/expandybird/requirements.txt
RUN pip install --no-cache-dir -r /var/expandybird/requirements.txt
ADD requirements.txt ./requirements.txt RUN cp "$GOPATH"/bin/expandybird /var/expandybird/expandybird
RUN pip install -r ./requirements.txt RUN /bin/rm -rf "$GOPATH"
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT ["./expandybird", "-expansion_binary", "./expansion/expansion.py"] ENTRYPOINT ["/var/expandybird/expandybird", "-expansion_binary", "/var/expandybird/expansion/expansion.py"]
...@@ -14,14 +14,15 @@ ...@@ -14,14 +14,15 @@
include ../include.mk include ../include.mk
.PHONY : all build test push container clean .PHONY : all build push container clean .project
DOCKER_REGISTRY := gcr.io DOCKER_REGISTRY := gcr.io
PREFIX := $(DOCKER_REGISTRY)/$(PROJECT) PREFIX := $(DOCKER_REGISTRY)/$(PROJECT)
IMAGE := expandybird IMAGE := expandybird
TAG := latest TAG := latest
DIR := . ROOT_DIR := $(abspath ./..)
DIR = $(ROOT_DIR)
push: container push: container
ifeq ($(DOCKER_REGISTRY),gcr.io) ifeq ($(DOCKER_REGISTRY),gcr.io)
...@@ -30,18 +31,11 @@ else ...@@ -30,18 +31,11 @@ else
docker push $(PREFIX)/$(IMAGE):$(TAG) docker push $(PREFIX)/$(IMAGE):$(TAG)
endif endif
container: expandybird container:
cp $(shell which expandybird) . docker build -t $(PREFIX)/$(IMAGE):$(TAG) -f Dockerfile $(DIR)
docker build -t $(PREFIX)/$(IMAGE):$(TAG) $(DIR)
rm -f expandybird
expandybird:
go get -v ./...
go install -v ./...
clean: clean:
-docker rmi $(PREFIX)/$(IMAGE):$(TAG) -docker rmi $(PREFIX)/$(IMAGE):$(TAG)
rm -f expandybird
.PHONY: test .PHONY: test
test: lint vet test-unit test: lint vet test-unit
...@@ -33,6 +33,7 @@ WORKDIR "$GOPATH"/src/github.com/kubernetes/deployment-manager/manager ...@@ -33,6 +33,7 @@ WORKDIR "$GOPATH"/src/github.com/kubernetes/deployment-manager/manager
RUN go-wrapper download RUN go-wrapper download
RUN go-wrapper install RUN go-wrapper install
WORKDIR /usr/local/bin
RUN cp "$GOPATH"/bin/manager /usr/local/bin RUN cp "$GOPATH"/bin/manager /usr/local/bin
RUN /bin/rm -rf "$GOPATH" RUN /bin/rm -rf "$GOPATH"
......
...@@ -32,6 +32,7 @@ WORKDIR "$GOPATH"/src/github.com/kubernetes/deployment-manager/resourcifier ...@@ -32,6 +32,7 @@ WORKDIR "$GOPATH"/src/github.com/kubernetes/deployment-manager/resourcifier
RUN go-wrapper download RUN go-wrapper download
RUN go-wrapper install RUN go-wrapper install
WORKDIR /usr/local/bin
RUN cp "$GOPATH"/bin/resourcifier /usr/local/bin RUN cp "$GOPATH"/bin/resourcifier /usr/local/bin
RUN /bin/rm -rf "$GOPATH" RUN /bin/rm -rf "$GOPATH"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment