Compile device-manager statically and use scratch base image

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
This commit is contained in:
Alexandre Peixoto Ferreira 2022-09-11 09:39:34 -05:00
parent d65b7208db
commit 07f4b88b53
No known key found for this signature in database
GPG Key ID: 9BDC9DE410CFC23B

View File

@ -10,15 +10,13 @@ COPY . .
RUN echo $PATH;export CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' && \
go mod init arm.com/smarter-device-management && go mod tidy && go mod vendor && \
go build -ldflags="-s -w" .
CGO_ENABLED=0 go build -ldflags='-s -w -extldflags="-static"' .
FROM alpine
RUN apk update && apk upgrade
FROM scratch
WORKDIR /root
COPY conf.yaml /root/config/conf.yaml
COPY --from=build /arm.com/smarter-device-management/smarter-device-management /usr/bin/smarter-device-management
CMD ["smarter-device-management","-logtostderr=true","-v=0"]
CMD ["/usr/bin/smarter-device-management","-logtostderr=true","-v=0"]