diff --git a/Makefile b/Makefile index 24276c1f..9e842082 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,8 @@ NAME = weaveworksdemos/catalogue +DBNAME = weaveworksdemos/catalogue-db + +TAG=$(TRAVIS_COMMIT) + INSTANCE = catalogue .PHONY: default build copy @@ -18,3 +22,9 @@ release: run: docker run --rm -p 8080:80 --name $(INSTANCE) $(NAME) + +dockertravisbuild: build + docker build -t $(NAME):$(TAG) -f docker/catalogue/Dockerfile-release docker/catalogue/ + docker build -t $(DBNAME):$(TAG) -f docker/catalogue-db/Dockerfile docker/catalogue-db/ + docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) + scripts/push.sh \ No newline at end of file diff --git a/docker/catalogue-db/Dockerfile b/docker/catalogue-db/Dockerfile new file mode 100644 index 00000000..a237d3de --- /dev/null +++ b/docker/catalogue-db/Dockerfile @@ -0,0 +1,8 @@ +FROM mysql:5.7 + +# ENV MYSQL_ROOT_PASSWORD DEFAULT_PASS +# ENV MYSQL_ALLOW_EMPTY_PASSWORD=true +# ENV MYSQL_DATABASE=socksdb + +COPY ./data/dump.sql /docker-entrypoint-initdb.d/ + diff --git a/data/dump.sql b/docker/catalogue-db/data/dump.sql similarity index 100% rename from data/dump.sql rename to docker/catalogue-db/data/dump.sql diff --git a/docker/catalogue/Dockerfile b/docker/catalogue/Dockerfile index 48667e14..755e1b73 100644 --- a/docker/catalogue/Dockerfile +++ b/docker/catalogue/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.6 RUN mkdir /app COPY . /go/src/github.com/microservices-demo/catalogue/ -COPY images/ /app/images/ +COPY images/ /images/ RUN go get github.com/gorilla/mux github.com/go-kit/kit/log github.com/go-kit/kit/endpoint github.com/go-kit/kit/transport/http github.com/go-sql-driver/mysql github.com/jmoiron/sqlx github.com/go-kit/kit/metrics/prometheus github.com/prometheus/client_golang/prometheus diff --git a/scripts/build.sh b/scripts/build.sh index 29428865..8bd726c3 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -41,3 +41,7 @@ $DOCKER_CMD build \ --build-arg COMMIT=$COMMIT \ -t ${REPO}:${COMMIT} \ -f $CODE_DIR/docker/catalogue/Dockerfile-release $CODE_DIR/docker/catalogue; + +$DOCKER_CMD build \ + -t ${REPO}-db:${COMMIT} \ + -f $CODE_DIR/docker/catalogue-db/Dockerfile $CODE_DIR/docker/catalogue-db;