1 Commits
3 changed files with 16 additions and 17 deletions
+6 -1
View File
@@ -1,8 +1,13 @@
FROM golang:1.10.1 as build
WORKDIR /go/src/mcquay.me/lim
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /usr/local/bin/lim .
FROM alpine:latest FROM alpine:latest
RUN apk --no-cache add ca-certificates RUN apk --no-cache add ca-certificates
WORKDIR / WORKDIR /
COPY build/lim /bin/ COPY --from=build /usr/local/bin/lim /bin/
CMD ["/bin/sh", "-c", "cat /dev/urandom | /bin/lim 16b | xxd"] CMD ["/bin/sh", "-c", "cat /dev/urandom | /bin/lim 16b | xxd"]
-7
View File
@@ -1,7 +0,0 @@
FROM golang:1.10.1
WORKDIR /go/src/mcquay.me/lim
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /usr/local/bin/lim .
+10 -9
View File
@@ -1,19 +1,20 @@
GOFILES := $(shell find . -type f | grep go$$ ) GOFILES := $(shell find . -type f | grep go$$ )
build/lim: build ${GOFILES} build/lim: build build/.docker-image ${GOFILES}
@docker build -t smcquay/lim:build . -f Dockerfile.build > /dev/null @echo "fetching binary from image"
@docker create --name ext smcquay/lim:build > /dev/null @docker create --name ext smcquay/lim:latest > /dev/null
@docker cp ext:/usr/local/bin/lim build/ > /dev/null @docker cp ext:/bin/lim build/ > /dev/null
@docker rm -f ext > /dev/null @docker rm -f ext > /dev/null
@docker image rm smcquay/lim:build > /dev/null @touch build/lim
build/.docker-image: ${GOFILES}
@echo "building docker image"
@docker build --no-cache -t smcquay/lim:latest . > /dev/null
@touch build/.docker-image
build: build:
@mkdir build @mkdir build
.PHONY: docker-image
docker-image: build/lim
@docker build --no-cache -t smcquay/lim:latest . > /dev/null
.PHONY: clean .PHONY: clean
clean: clean:
@rm -rf build @rm -rf build