implements builder pattern for lim

This commit is contained in:
Stephen McQuay 2018-04-17 11:58:40 -07:00
parent d7eb517c65
commit 3fb9fadfb1
Signed by: sm
GPG Key ID: 4E4B72F479BA3CE5
4 changed files with 35 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /
COPY build/lim /bin/
CMD ["/bin/sh", "-c", "cat /dev/urandom | /bin/lim 16b | xxd"]

7
Dockerfile.build Normal file
View File

@ -0,0 +1,7 @@
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 .

19
Makefile Normal file
View File

@ -0,0 +1,19 @@
GOFILES := $(shell find . -type f | grep go$$ )
build/lim: build ${GOFILES}
docker build -t smcquay/lim:build . -f Dockerfile.build
docker create --name ext smcquay/lim:build
docker cp ext:/usr/local/bin/lim build/
docker rm -f ext
docker image rm smcquay/lim:build
build:
@mkdir build
.PHONY: docker-image
docker-image: build/lim
docker build --no-cache -t smcquay/lim:latest .
.PHONY: clean
clean:
@rm -rf build