Merged in feature/ecr (pull request #159)
Test * tests * tar * go * tmp * test * go * go * go * config * goup * versioning * order * cleanup * git * smallopts * flags * lessisgood * go * order * ordermatters * order * cc * test
This commit is contained in:
+24
-18
@@ -6,22 +6,24 @@ FROM golang:${GO_VERSION} AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends git=1:2.* musl-tools=1.2.* && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt-get/lists/*
|
||||
RUN mkdir bin/
|
||||
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
COPY vendor/ vendor/
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends git=1:2.* musl-tools=1.2.* && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN go install -a -installsuffix cgo std
|
||||
|
||||
COPY --link go.mod .
|
||||
COPY --link go.sum .
|
||||
COPY --link vendor/ vendor/
|
||||
|
||||
RUN go mod verify
|
||||
|
||||
COPY cmd/ cmd/
|
||||
COPY api/ api/
|
||||
COPY internal/ internal/
|
||||
|
||||
COPY --link .git/ .git/
|
||||
COPY --link cmd/ cmd/
|
||||
COPY --link api/ api/
|
||||
COPY --link internal/ internal/
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
@@ -29,12 +31,16 @@ ENV CGO_ENABLED=1
|
||||
ENV GOARCH=${TARGETARCH}
|
||||
ENV CC=musl-gcc
|
||||
|
||||
RUN mkdir bin/ && \
|
||||
go build \
|
||||
-mod vendor \
|
||||
-tags musl \
|
||||
-ldflags "-linkmode external -extldflags -static" \
|
||||
-o bin/ ./cmd/...
|
||||
ARG GIT_VERSION=dev
|
||||
ARG GIT_COMMIT=unknown
|
||||
|
||||
RUN go build \
|
||||
-mod vendor \
|
||||
-tags musl \
|
||||
-trimpath \
|
||||
-installsuffix cgo \
|
||||
-ldflags "-s -w -linkmode external -extldflags '-static -Wl,--as-needed -Wl,--gc-sections -Wl,-O1' -X main.version=${GIT_VERSION} -X main.gitCommit=${GIT_COMMIT}" \
|
||||
-o bin/ ./cmd/...
|
||||
|
||||
FROM scratch AS final
|
||||
|
||||
|
||||
Reference in New Issue
Block a user