Skip to content

Commit e74aa9d

Browse files
committed
fix: pkger support for makefile & Dockerfile
1 parent e774cf8 commit e74aa9d

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ARG VERSION=0.0.1
4444
ARG TYPE=srv
4545
ARG TARGET=account
4646

47-
RUN pkger -o $TYPE/$TARGET -include /deploy/bases/micros/$TARGET-$TYPE/config
47+
RUN pkger -o $TYPE/$TARGET -include /config
4848
RUN go build -a \
4949
-ldflags="-w -s -linkmode external -extldflags '-static' $(govvv -flags -version ${VERSION} -pkg $(go list ./shared/config) )" \
5050
-o /app ./$TYPE/$TARGET/main.go ./$TYPE/$TARGET/plugin.go

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ endif
115115
for _target in $${type}/*/; do \
116116
temp=$${_target%%/}; target=$${temp#*/}; \
117117
echo "\tPackaging config for $${target}-$${type}"; \
118-
${GOPATH}/bin/pkger -o $${type}/$${target} -include /deploy/bases/micros/$${target}-$${type}/config; \
118+
${GOPATH}/bin/pkger -o $${type}/$${target} -include /config; \
119119
done \
120120
done \
121121
else \
122122
echo "Packaging config for ${TARGET}-${TYPE}..."; \
123-
${GOPATH}/bin/pkger -o ${TYPE}/${TARGET} -include /deploy/bases/micros/${TARGET}-${TYPE}/config ; \
123+
${GOPATH}/bin/pkger -o ${TYPE}/${TARGET} -include /config ; \
124124
fi
125125

126126
build build-%: pkger-%

cgo.dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ WORKDIR /src
3333
COPY ./go.mod ./go.sum ./
3434
# Get dependancies - will also be cached if we won't change mod/sum
3535
RUN go mod download && \
36-
GO111MODULE=off go get github.com/ahmetb/govvv
36+
GO111MODULE=off go get github.com/ahmetb/govvv && \
37+
go install github.com/markbates/pkger/cmd/pkger
3738

3839
# COPY the source code as the last step
3940
COPY ./ ./
@@ -43,6 +44,7 @@ ARG VERSION=0.0.1
4344
ARG TYPE=srv
4445
ARG TARGET=account
4546

47+
RUN pkger -o $TYPE/$TARGET -include /config
4648
RUN go build -a \
4749
-ldflags="-w -s -linkmode external -extldflags '-static' $(govvv -flags -version ${VERSION} -pkg $(go list ./shared/config) )" \
4850
-o /app ./$TYPE/$TARGET/main.go ./$TYPE/$TARGET/plugin.go

no_cgo.dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ WORKDIR /src
3131
COPY ./go.mod ./go.sum ./
3232
# Get dependancies - will also be cached if we won't change mod/sum
3333
RUN go mod download && \
34-
GO111MODULE=off go get github.com/ahmetb/govvv
34+
GO111MODULE=off go get github.com/ahmetb/govvv && \
35+
go install github.com/markbates/pkger/cmd/pkger
3536

3637
# COPY the source code as the last step
3738
COPY ./ ./
@@ -41,6 +42,7 @@ ARG VERSION=0.0.1
4142
ARG TYPE=srv
4243
ARG TARGET=account
4344

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

0 commit comments

Comments
 (0)