mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
68befa023c
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
32 lines
849 B
Docker
32 lines
849 B
Docker
# Copyright (c) Abstract Machines
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
FROM golang:1.26.2-alpine3.22 AS builder
|
|
ARG SVC
|
|
ARG GOARCH
|
|
ARG GOARM
|
|
ARG VERSION
|
|
ARG COMMIT
|
|
ARG TIME
|
|
ARG BUILD_TAGS
|
|
|
|
WORKDIR /go/src/github.com/absmach/magistrala
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} GOARM=${GOARM} \
|
|
go build \
|
|
-trimpath \
|
|
-mod=readonly \
|
|
-buildvcs=false \
|
|
-tags "${BUILD_TAGS}" \
|
|
-ldflags "-s -w \
|
|
-X 'github.com/absmach/magistrala.BuildTime=${TIME}' \
|
|
-X 'github.com/absmach/magistrala.Version=${VERSION}' \
|
|
-X 'github.com/absmach/magistrala.Commit=${COMMIT}'" \
|
|
-o /exe cmd/${SVC}/main.go
|
|
|
|
FROM scratch
|
|
# Certificates are needed so that mailing util can work.
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
COPY --from=builder /exe /
|
|
ENTRYPOINT ["/exe"]
|