github.com/ztalab/ZACA@v0.0.1/pkg/caclient/examples/server/Dockerfile (about)

     1  FROM golang:1.15 AS build
     2  WORKDIR /capitalizone
     3  ADD ../../../../ .
     4  ARG TAG
     5  ARG REPO_INFO
     6  ARG COMMIT
     7  RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build pkg/caclient/examples/server/server.go -mod vendor -o server -ldflags "-s -w -X main.RELEASE=$TAG -X main.COMMIT=$COMMIT -X main.REPO=$REPO_INFO"
     8  
     9  # Final stage: the running container.
    10  FROM alpine:3.11
    11  RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
    12      && apk --no-cache add ca-certificates
    13  
    14  # Create the user (ID 1000) and group that will be used in the
    15  # running container to run the process as an unprivileged user.
    16  RUN addgroup -S nerv && \
    17      adduser -S nerv -G nerv -u 1000
    18  
    19  WORKDIR /capitalizone
    20  
    21  # Import the compiled executable from the second stage.
    22  COPY --from=build /capitalizone/server /bin
    23  # Only for backwards compatibility
    24  COPY --from=build /capitalizone/ .
    25  
    26  RUN ls -al
    27  
    28  # Perform any further action as an unprivileged user.
    29  USER 1000
    30  
    31  # Run the compiled binary.
    32  CMD ["server"]