Skip to content

Commit

Permalink
build and packaging updates
Browse files Browse the repository at this point in the history
1. Update Dockerfile.dapper to install Go 1.12, separate go gets for better image layer caching

2. replace ubuntu image with simple alpine base image

3. add linker flag -w for smaller binary

4. gitignore some generated files
  • Loading branch information
anitgandhi authored and yasker committed Apr 10, 2019
1 parent 6c8a86c commit 6af86e3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

*dapper*
!Dockerfile.dapper
bin/
4 changes: 2 additions & 2 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker
ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash

RUN wget -O - https://storage.googleapis.com/golang/go1.11.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
go get github.com/rancher/trash && go get github.com/golang/lint/golint
RUN wget -O - https://storage.googleapis.com/golang/go1.12.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local
RUN go get github.com/rancher/trash && go get golang.org/x/lint/golint

ENV DAPPER_SOURCE /go/src/github.com/rancher/local-path-provisioner
ENV DAPPER_OUTPUT ./bin
Expand Down
9 changes: 3 additions & 6 deletions package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM ubuntu:16.04
FROM alpine:latest

RUN apt-get update && apt-get install -y curl vim nfs-common iproute dnsutils iputils-ping telnet
COPY bin /bin

COPY bin /usr/local/sbin/

VOLUME /usr/local/sbin
CMD ["local-path-provisioner"]
ENTRYPOINT ["/bin/local-path-provisioner"]
2 changes: 1 addition & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ cd $(dirname $0)/..
VERSION=${VERSION:-$(./scripts/version)}

mkdir -p bin
[ "$(uname)" != "Darwin" ] && LINKFLAGS="-extldflags -static -s"
[ "$(uname)" != "Darwin" ] && LINKFLAGS="-extldflags -static -s -w"
CGO_ENABLED=0 go build -ldflags "-X main.VERSION=$VERSION $LINKFLAGS" -o bin/local-path-provisioner

0 comments on commit 6af86e3

Please sign in to comment.