diff --git a/.cirrus.yml b/.cirrus.yml index e27ee28..9663a8d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,4 +6,16 @@ test_task: CIRRUS_WORKING_DIR: /go/src/github.com/$CIRRUS_REPO_FULL_NAME get_script: go get -t -v ./... vet_script: go vet -v ./... - test_script: go test -v ./... \ No newline at end of file + test_script: go test -v ./... + +deploy_docker_builder: + only_if: $CIRRUS_BRANCH == "master" + depends_on: test + environment: + DOCKER_USER_NAME: ENCRYPTED[81138e1a6e2213ac2c2ab7fe39ac91c304928046e984a2a947aab3ed3860802b9a95a72206ba0769f00bbe4f21a84c2d] + DOCKER_PASSWORD: ENCRYPTED[61d7105b225c7aae7fabe036dff68618f31ec89ac6ccd16b00d9de69c80ceb7aec02e3c5b9c19aa24379553177fc5b00] + build_script: + - docker build --tag cirrusci/google-storage-proxy:latest . + push_script: + - docker login --username $DOCKER_USER_NAME --password $DOCKER_PASSWORD + - docker push cirrusci/google-storage-proxy:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..612d8bb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.10-alpine as builder + +RUN apk update && apk upgrade && \ + apk add --no-cache git + +WORKDIR /go/src/github.com/cirruslabs/google-storage-proxy +ADD . /go/src/github.com/cirruslabs/google-storage-proxy + +RUN go get -t -v ./... && \ + go test -v ./... && \ + go build -o google-storage-proxy ./cmd/ + +FROM alpine +WORKDIR /svc +COPY --from=builder /go/src/github.com/cirruslabs/google-storage-proxy/google-storage-proxy /svc/ +ENTRYPOINT ["/svc/google-storage-proxy"] \ No newline at end of file