This repository has been archived by the owner on Jul 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the bits to make docker testing and release process work, including a…
… "version" command
- Loading branch information
Showing
6 changed files
with
203 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# vim: se syn=dockerfile: | ||
FROM golang:1.13-alpine AS build | ||
ENV CGO_ENABLED 0 | ||
|
||
RUN apk add --no-cache --update make git perl-utils dep shadow | ||
|
||
ENV PATH "/go/bin:${PATH}" | ||
|
||
RUN go get honnef.co/go/tools/cmd/staticcheck | ||
|
||
RUN mkdir -p /go/src/github.com/joyent/kosh | ||
WORKDIR /go/src/github.com/joyent/kosh | ||
|
||
COPY . /go/src/github.com/joyent/kosh/ | ||
|
||
RUN make | ||
|
||
FROM scratch | ||
COPY --from=build /go/src/github.com/joyent/kosh/bin/kosh /bin/kosh | ||
COPY --from=build /etc/ssl /etc/ssl | ||
|
||
ENV KOSH_TOKEN "broken" | ||
ENTRYPOINT [ "/bin/kosh" ] | ||
CMD ["version"] |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# vim: se syn=dockerfile: | ||
FROM golang:1.13-alpine AS build | ||
ENV CGO_ENABLED 0 | ||
|
||
RUN apk add --no-cache --update make git perl-utils dep shadow | ||
|
||
ARG UID="1000" | ||
ARG BRANCH="master" | ||
|
||
ENV GOPATH "/home/app/go" | ||
ENV PATH "${GOPATH}/bin:${PATH}" | ||
ENV GOCACHE "/home/app/.cache" | ||
|
||
RUN mkdir -p "${GOPATH}/src/github.com/joyent/" | ||
RUN chown -R $UID /home/app | ||
|
||
|
||
USER $UID | ||
ENV HOME "/home/app" | ||
|
||
RUN rm -rf release | ||
RUN rm -rf vendor | ||
|
||
RUN mkdir -p "${GOPATH}/src/github.com/joyent" | ||
WORKDIR "${GOPATH}/src/github.com/joyent/" | ||
RUN git clone --branch $BRANCH https://github.com/joyent/kosh kosh | ||
|
||
WORKDIR "${GOPATH}/src/github.com/joyent/kosh" | ||
RUN go get honnef.co/go/tools/cmd/staticcheck | ||
|
||
RUN id | ||
RUN env | ||
|
||
ENTRYPOINT ["make" ] | ||
CMD [ "release" ] | ||
|
||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
PWD=$(pwd) | ||
|
||
PREFIX="joyentbuildops" | ||
NAME="kosh" | ||
|
||
: ${BUILDNUMBER:=0} | ||
|
||
: ${BUILDER:=${USER}} | ||
BUILDER=$(echo "${BUILDER}" | sed 's/\//_/g' | sed 's/-/_/g') | ||
|
||
: ${LABEL:="latest"} | ||
LABEL=$(echo "${LABEL}" | sed 's/\//_/g') | ||
|
||
if test $LABEL == "master"; then | ||
LABEL="latest" | ||
fi | ||
|
||
: ${BRANCH:="master"} | ||
|
||
IMAGE_NAME="${PREFIX}/${NAME}:${LABEL}" | ||
|
||
mkdir -p release | ||
|
||
docker build \ | ||
-t ${IMAGE_NAME} \ | ||
--build-arg BRANCH=${BRANCH} \ | ||
--build-arg UID=$(id -u) \ | ||
--file Dockerfile.release . \ | ||
&& \ | ||
docker run --rm \ | ||
--name ${BUILDER}_${BUILDNUMBER} \ | ||
-u $(id -u):$(id -g) \ | ||
--mount type=bind,source="${PWD}/release",target="/home/app/go/src/github.com/joyent/kosh/release" \ | ||
${IMAGE_NAME} \ | ||
&& \ | ||
docker rmi ${IMAGE_NAME} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
: ${PREFIX:=$USER} | ||
: ${NAME:="kosh"} | ||
|
||
: ${BUILDNUMBER:=0} | ||
|
||
: ${BUILDER:=${USER}} | ||
BUILDER=$(echo "${BUILDER}" | sed 's/\//_/g' | sed 's/-/_/g') | ||
|
||
: ${LABEL:="latest"} | ||
LABEL=$(echo "${LABEL}" | sed 's/\//_/g') | ||
|
||
IMAGE_NAME="${PREFIX}/${NAME}:${LABEL}" | ||
|
||
docker build \ | ||
-t ${IMAGE_NAME} \ | ||
--file Dockerfile . \ | ||
&& \ | ||
docker run \ | ||
--rm \ | ||
--name ${BUILDER}_${BUILDNUMBER} \ | ||
${IMAGE_NAME} | ||
|
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