upd(build): dockerfiles and makefile update

This commit is contained in:
Tit Petric
2019-04-03 13:43:04 +02:00
parent 871b167b02
commit d18f53f7c6
6 changed files with 47 additions and 5 deletions
+34
View File
@@ -0,0 +1,34 @@
## == builder image ==
FROM golang:1.12-alpine AS builder
WORKDIR /go/src/github.com/crusttech/crust
COPY . .
RUN apk add --no-cache git
RUN mkdir /build; \
CGO_ENABLED=0 go build \
-ldflags "-X github.com/crusttech/crust/internal/version.BuildTime="`date +%FT%T%z`" -X github.com/crusttech/crust/internal/version.Version="`git describe --always --tags` \
-o /build/crust cmd/crust/*.go
## == webapp image ==
FROM crusttech/webapp:latest as webapp
## == target image ==
FROM alpine:3.7
RUN apk add --no-cache ca-certificates
COPY --from=builder /build /crust
COPY --from=webapp /crust/webapp /crust/webapp
EXPOSE 80
WORKDIR /crust
ENTRYPOINT /crust/crust
+8
View File
@@ -0,0 +1,8 @@
FROM golang:1.12-alpine
RUN apk add --no-cache git make bash && \
go get -u github.com/golang/mock/gomock && \
go get -u github.com/golang/mock/mockgen && \
go get -u github.com/rakyll/gotest && \
go get -u github.com/goware/statik && \
cd /usr/local/bin && wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod a+x wait-for-it.sh
+5 -5
View File
@@ -34,13 +34,13 @@ help:
docker: $(IMAGES:%=docker-image.%)
docker-image.%: %
@ docker build --no-cache --rm -f Dockerfile.$^ -t crusttech/api-$^:latest .
docker-image.%: Dockerfile.%
@ docker build --no-cache --rm -f Dockerfile.$* -t crusttech/$*:latest .
docker-push: $(IMAGES:%=docker-push.%)
docker-push.%: %
@ docker push crusttech/api-$^:latest
docker-push.%: Dockerfile.%
@ docker push crusttech/$*:latest
########################################################################################################################
@@ -50,7 +50,7 @@ realize: $(REALIZE)
$(REALIZE) start
dep.codegen:
go install github.com/titpetric/statik
go install github.com/goware/statik
dep.update: $(DEP)
$(DEP) ensure -update -v