forked from omissis/goarkitect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (39 loc) · 1.61 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
ARG VERSION=develop
ARG GIT_COMMIT=unknown
ARG GO_VERSION=1.23.2
FROM golang:${GO_VERSION}-alpine3.20 AS builder
ARG VERSION
ARG GIT_COMMIT
ARG GO_VERSION
WORKDIR /app
COPY go.mod go.sum .
RUN go mod download
COPY main.go /app/main.go
COPY api/ /app/api/
COPY cmd/ /app/cmd/
COPY internal/ /app/internal/
RUN CGO_ENABLED=0 go build -o /usr/local/bin/goarkitect \
-ldflags="-s -w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT} -X main.buildTime=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -X main.goVersion=${GO_VERSION} -X main.osArch=$(uname -m)" \
.
FROM gcr.io/distroless/static AS static
LABEL maintainer="omissis"
# LABEL org.opencontainers.image.created
LABEL org.opencontainers.image.authors="omissis"
LABEL org.opencontainers.image.url="https://github.com/omissis/goarkitect"
LABEL org.opencontainers.image.documentation="https://github.com/omissis/goarkitect"
LABEL org.opencontainers.image.source="https://github.com/omissis/goarkitect"
# LABEL org.opencontainers.image.version
# LABEL org.opencontainers.image.revision
LABEL org.opencontainers.image.vendor="Omissis"
# LABEL org.opencontainers.image.licenses
# LABEL org.opencontainers.image.ref.name
LABEL org.opencontainers.image.title="goarkitect"
LABEL org.opencontainers.image.description="Describe and check architectural constraints of a project using a composable set of rules."
# LABEL org.opencontainers.image.base.digest
# LABEL org.opencontainers.image.base.name
USER nonroot:nonroot
ENTRYPOINT ["/goarkitect"]
FROM static AS dockerbuild
COPY --from=builder /usr/local/bin/goarkitect /goarkitect
FROM static AS goreleaser
COPY goarkitect /goarkitect