Skip to content

Commit

Permalink
fix: pkger support for makefile & Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Nov 15, 2019
1 parent e774cf8 commit e74aa9d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ARG VERSION=0.0.1
ARG TYPE=srv
ARG TARGET=account

RUN pkger -o $TYPE/$TARGET -include /deploy/bases/micros/$TARGET-$TYPE/config
RUN pkger -o $TYPE/$TARGET -include /config
RUN go build -a \
-ldflags="-w -s -linkmode external -extldflags '-static' $(govvv -flags -version ${VERSION} -pkg $(go list ./shared/config) )" \
-o /app ./$TYPE/$TARGET/main.go ./$TYPE/$TARGET/plugin.go
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ endif
for _target in $${type}/*/; do \
temp=$${_target%%/}; target=$${temp#*/}; \
echo "\tPackaging config for $${target}-$${type}"; \
${GOPATH}/bin/pkger -o $${type}/$${target} -include /deploy/bases/micros/$${target}-$${type}/config; \
${GOPATH}/bin/pkger -o $${type}/$${target} -include /config; \
done \
done \
else \
echo "Packaging config for ${TARGET}-${TYPE}..."; \
${GOPATH}/bin/pkger -o ${TYPE}/${TARGET} -include /deploy/bases/micros/${TARGET}-${TYPE}/config ; \
${GOPATH}/bin/pkger -o ${TYPE}/${TARGET} -include /config ; \
fi

build build-%: pkger-%
Expand Down
4 changes: 3 additions & 1 deletion cgo.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ WORKDIR /src
COPY ./go.mod ./go.sum ./
# Get dependancies - will also be cached if we won't change mod/sum
RUN go mod download && \
GO111MODULE=off go get github.com/ahmetb/govvv
GO111MODULE=off go get github.com/ahmetb/govvv && \
go install github.com/markbates/pkger/cmd/pkger

# COPY the source code as the last step
COPY ./ ./
Expand All @@ -43,6 +44,7 @@ ARG VERSION=0.0.1
ARG TYPE=srv
ARG TARGET=account

RUN pkger -o $TYPE/$TARGET -include /config
RUN go build -a \
-ldflags="-w -s -linkmode external -extldflags '-static' $(govvv -flags -version ${VERSION} -pkg $(go list ./shared/config) )" \
-o /app ./$TYPE/$TARGET/main.go ./$TYPE/$TARGET/plugin.go
Expand Down
4 changes: 3 additions & 1 deletion no_cgo.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ WORKDIR /src
COPY ./go.mod ./go.sum ./
# Get dependancies - will also be cached if we won't change mod/sum
RUN go mod download && \
GO111MODULE=off go get github.com/ahmetb/govvv
GO111MODULE=off go get github.com/ahmetb/govvv && \
go install github.com/markbates/pkger/cmd/pkger

# COPY the source code as the last step
COPY ./ ./
Expand All @@ -41,6 +42,7 @@ ARG VERSION=0.0.1
ARG TYPE=srv
ARG TARGET=account

RUN pkger -o $TYPE/$TARGET -include /config
RUN go build -a \
-ldflags="-w -s $(govvv -flags -version ${VERSION} -pkg $(go list ./shared/config) )" \
-o /app ./$TYPE/$TARGET/main.go ./$TYPE/$TARGET/plugin.go
Expand Down

0 comments on commit e74aa9d

Please sign in to comment.