Split Dockerfile

This commit is contained in:
IamTheFij 2018-08-07 21:58:10 -07:00
parent 2cee9c8513
commit af00d3baf2
3 changed files with 19 additions and 4 deletions

View File

@ -1,5 +1,4 @@
ARG repo_arch FROM golang:1.10 AS builder
FROM ${repo_arch}golang:1.10 AS builder
RUN go get -u github.com/golang/dep/cmd/dep RUN go get -u github.com/golang/dep/cmd/dep
@ -10,7 +9,7 @@ RUN dep ensure --vendor-only
COPY ./main.go /go/src/app/ COPY ./main.go /go/src/app/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dsched . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dsched .
FROM ${repo_arch}busybox:latest FROM busybox:latest
WORKDIR /root/ WORKDIR /root/
COPY --from=builder /go/src/app/dsched . COPY --from=builder /go/src/app/dsched .

16
Dockerfile.arm32v7 Normal file
View File

@ -0,0 +1,16 @@
FROM arm32v7/golang:1.10 AS builder
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/app/
COPY ./Gopkg.* /go/src/app/
RUN dep ensure --vendor-only
COPY ./main.go /go/src/app/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dsched .
FROM arm32v7/busybox:latest
WORKDIR /root/
COPY --from=builder /go/src/app/dsched .
CMD [ "./dsched" ]

View File

@ -41,7 +41,7 @@ docker-build:
.PHONY: docker-build-arm .PHONY: docker-build-arm
docker-build-arm: docker-build-arm:
docker build --build-arg repo_arch=arm32v7/ -t $(DOCKER_TAG)-arm32v7 . docker build -t $(DOCKER_TAG)-arm32v7 ./Dockerfile.arm32v7
.PHONY: docker-run .PHONY: docker-run
docker-run: docker-run: