-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from Financial-Times/fix/uppsf-666-update-base…
…-image Update CircleCI Transition to multistage scratch build Update to go modules Update panicGuide url to Runbook Update README
- Loading branch information
Showing
8 changed files
with
208 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
FROM golang:1.10-alpine | ||
FROM golang:1 | ||
|
||
ENV PROJECT=generic-rw-s3 | ||
COPY . /${PROJECT}-sources/ | ||
|
||
RUN apk --no-cache --virtual .build-dependencies add git curl \ | ||
&& ORG_PATH="github.com/Financial-Times" \ | ||
&& REPO_PATH="${ORG_PATH}/${PROJECT}" \ | ||
&& mkdir -p $GOPATH/src/${ORG_PATH} \ | ||
# Linking the project sources in the GOPATH folder | ||
&& ln -s /${PROJECT}-sources $GOPATH/src/${REPO_PATH} \ | ||
&& cd $GOPATH/src/${REPO_PATH} \ | ||
&& BUILDINFO_PACKAGE="${ORG_PATH}/${PROJECT}/vendor/${ORG_PATH}/service-status-go/buildinfo." \ | ||
&& VERSION="version=$(git describe --tag --always 2> /dev/null)" \ | ||
ENV ORG_PATH="github.com/Financial-Times" | ||
ENV BUILDINFO_PACKAGE="${ORG_PATH}/service-status-go/buildinfo." | ||
|
||
COPY . /${PROJECT}/ | ||
WORKDIR /${PROJECT}/ | ||
|
||
RUN VERSION="version=$(git describe --tag --always 2> /dev/null)" \ | ||
&& DATETIME="dateTime=$(date -u +%Y%m%d%H%M%S)" \ | ||
&& REPOSITORY="repository=$(git config --get remote.origin.url)" \ | ||
&& REVISION="revision=$(git rev-parse HEAD)" \ | ||
&& BUILDER="builder=$(go version)" \ | ||
&& LDFLAGS="-X '"${BUILDINFO_PACKAGE}$VERSION"' -X '"${BUILDINFO_PACKAGE}$DATETIME"' -X '"${BUILDINFO_PACKAGE}$REPOSITORY"' -X '"${BUILDINFO_PACKAGE}$REVISION"' -X '"${BUILDINFO_PACKAGE}$BUILDER"'" \ | ||
&& echo "Build flags: $LDFLAGS" \ | ||
&& echo "Fetching dependencies..." \ | ||
&& curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh \ | ||
&& $GOPATH/bin/dep ensure -vendor-only \ | ||
&& go build -ldflags="${LDFLAGS}" \ | ||
&& mv ${PROJECT} /${PROJECT} \ | ||
&& apk del .build-dependencies \ | ||
&& rm -rf $GOPATH /var/cache/apk/* | ||
&& CGO_ENABLED=0 go build -mod=readonly -o /artefacts/${PROJECT} -ldflags="${LDFLAGS}" | ||
|
||
FROM scratch | ||
WORKDIR / | ||
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=0 /artefacts/* / | ||
|
||
CMD ["/generic-rw-s3"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.