Skip to content

Commit 07f4b88

Browse files
committed
Compile device-manager statically and use scratch base image
Signed-off-by: Alexandre Peixoto Ferreira <[email protected]>
1 parent d65b720 commit 07f4b88

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ COPY . .
1010

1111
RUN echo $PATH;export CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' && \
1212
go mod init arm.com/smarter-device-management && go mod tidy && go mod vendor && \
13-
go build -ldflags="-s -w" .
13+
CGO_ENABLED=0 go build -ldflags='-s -w -extldflags="-static"' .
1414

15-
FROM alpine
16-
17-
RUN apk update && apk upgrade
15+
FROM scratch
1816

1917
WORKDIR /root
2018

2119
COPY conf.yaml /root/config/conf.yaml
2220
COPY --from=build /arm.com/smarter-device-management/smarter-device-management /usr/bin/smarter-device-management
2321

24-
CMD ["smarter-device-management","-logtostderr=true","-v=0"]
22+
CMD ["/usr/bin/smarter-device-management","-logtostderr=true","-v=0"]

0 commit comments

Comments
 (0)