github.com/Financial-Times/publish-availability-monitor@v1.12.0/Dockerfile (about)

     1  FROM golang:1
     2  
     3  ENV PROJECT=publish-availability-monitor
     4  
     5  ENV ORG_PATH="github.com/Financial-Times"
     6  ENV BUILDINFO_PACKAGE="github.com/Financial-Times/service-status-go/buildinfo."
     7  
     8  COPY . /${PROJECT}/
     9  WORKDIR /${PROJECT}
    10  
    11  RUN VERSION="version=$(git describe --tag --always 2> /dev/null)" \
    12    && DATETIME="dateTime=$(date -u +%Y%m%d%H%M%S)" \
    13    && REPOSITORY="repository=$(git config --get remote.origin.url)" \
    14    && REVISION="revision=$(git rev-parse HEAD)" \
    15    && BUILDER="builder=$(go version)" \
    16    && LDFLAGS="-s -w -X '"${BUILDINFO_PACKAGE}$VERSION"' -X '"${BUILDINFO_PACKAGE}$DATETIME"' -X '"${BUILDINFO_PACKAGE}$REPOSITORY"' -X '"${BUILDINFO_PACKAGE}$REVISION"' -X '"${BUILDINFO_PACKAGE}$BUILDER"'" \
    17    && CGO_ENABLED=0 go build -mod=readonly -o /artifacts/${PROJECT} -v -ldflags="${LDFLAGS}" \
    18    && echo "Build flags: $LDFLAGS" 
    19  
    20  # Multi-stage build - copy certs and the binary into the image
    21  # We build from alpine because scratch does not have bash
    22  FROM alpine
    23  WORKDIR /	
    24  COPY --from=0 /publish-availability-monitor/config.json.template /config.json 
    25  COPY --from=0 /publish-availability-monitor/startup.sh /
    26  COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
    27  COPY --from=0 /artifacts/* /
    28  
    29  CMD [ "/startup.sh" ]