Skip to content
Snippets Groups Projects
Commit 6af86e31 authored by Anit Gandhi's avatar Anit Gandhi Committed by Sheng Yang
Browse files

build and packaging updates

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
parent 6c8a86ca
Branches
Tags
No related merge requests found
...@@ -10,3 +10,7 @@ ...@@ -10,3 +10,7 @@
# Output of the go coverage tool, specifically when used with LiteIDE # Output of the go coverage tool, specifically when used with LiteIDE
*.out *.out
*dapper*
!Dockerfile.dapper
bin/
\ No newline at end of file
...@@ -19,8 +19,8 @@ RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker ...@@ -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} \ 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 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 && \ RUN wget -O - https://storage.googleapis.com/golang/go1.12.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local
go get github.com/rancher/trash && go get github.com/golang/lint/golint 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_SOURCE /go/src/github.com/rancher/local-path-provisioner
ENV DAPPER_OUTPUT ./bin ENV DAPPER_OUTPUT ./bin
......
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/ ENTRYPOINT ["/bin/local-path-provisioner"]
VOLUME /usr/local/sbin
CMD ["local-path-provisioner"]
...@@ -5,5 +5,5 @@ cd $(dirname $0)/.. ...@@ -5,5 +5,5 @@ cd $(dirname $0)/..
VERSION=${VERSION:-$(./scripts/version)} VERSION=${VERSION:-$(./scripts/version)}
mkdir -p bin 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 CGO_ENABLED=0 go build -ldflags "-X main.VERSION=$VERSION $LINKFLAGS" -o bin/local-path-provisioner
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment