Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Update go to 1.12 and refactor cmd tool code.
Browse files Browse the repository at this point in the history
  • Loading branch information
icedream committed May 23, 2019
1 parent 2f5e438 commit 6653b4a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ _cgo_export.*

_testmain.go

workreportmgr
*.exe
*.test

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ _cgo_export.*

_testmain.go

workreportmgr
*.exe
*.test
46 changes: 27 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
FROM golang:1.8-alpine
FROM golang:1.12-alpine

ARG GO_ROOT_IMPORT_PATH=github.com/icedream/workreport-manager

COPY . "/go/src/${GO_ROOT_IMPORT_PATH}"
RUN \
apk add --no-cache --virtual .build-deps \
git \
libc-dev \
&&\
git config --global http.followRedirects true &&\
mkdir -p /go &&\
export GOPATH=/go &&\
export PATH="${PATH}:${GOPATH}/bin" &&\
libc-dev

# Git configuration
RUN git config --global http.followRedirects true

# Install tools which will be used by go generate
RUN \
go get -v \
github.com/jteeuwen/go-bindata/... \
golang.org/x/tools/cmd/goimports &&\
export CGO_ENABLED=0 &&\
go get -v -d "${GO_ROOT_IMPORT_PATH}/..." &&\
(cd "${GOPATH}/src/${GO_ROOT_IMPORT_PATH}" &&\
go generate -v ./...) &&\
go build -v -a -installsuffix cgo \
-o /usr/local/bin/workreportmgr "${GO_ROOT_IMPORT_PATH}" &&\
apk del .build-deps &&\
rm -rf "${GOPATH}"
golang.org/x/tools/cmd/goimports

# Copy app source, fetch dependencies and build all binaries
WORKDIR /usr/src/app
COPY . .
RUN go generate -v ./...
RUN \
CGO_ENABLED=0 \
GOBIN="/usr/local/bin" \
go install -v -a -installsuffix cgo ./cmd/...

RUN ls -lAh /usr/local/bin

###

FROM alpine

# Copy built binaries into this image
COPY --from=0 /usr/local/bin/ /usr/local/bin/

ENTRYPOINT ["workreportmgr"]
File renamed without changes.

0 comments on commit 6653b4a

Please sign in to comment.