From f6c0ec0921ffe34be593124ec5cce2d6a0808f67 Mon Sep 17 00:00:00 2001 From: Dan Garfield Date: Sun, 19 Apr 2020 10:19:51 -0600 Subject: [PATCH 1/3] create multi-stage docker file for easy builds --- Dockerfile | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e6cdccdb..10576b19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,23 @@ +#Build Stage +FROM golang:1.14.2-alpine as builder +ENV GOPROXY=https://gocenter.io + +#Add packages for dependency management +RUN apk add dep +RUN apk add git + +#Copy project files and get dependencies +COPY . /go/src/github.com/munnerz/kube-plex +WORKDIR /go/src/github.com/munnerz/kube-plex +RUN set -x && \ + go get . && \ + dep ensure -v + +#Run Build +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o kube-plex_linux_amd64 /go/src/github.com/munnerz/kube-plex +RUN ls /go/src/github.com/munnerz/kube-plex + +#Copy into clean container FROM alpine:3.6 -ADD kube-plex_linux_amd64 /kube-plex +COPY --from=builder /go/src/github.com/munnerz/kube-plex/kube-plex_linux_amd64 /kube-plex From 3f1256225be36ca74debdd8580ad96da6e939153 Mon Sep 17 00:00:00 2001 From: Dan Garfield Date: Thu, 23 Apr 2020 09:18:46 -0600 Subject: [PATCH 2/3] Add build badge and codefresh yaml for CI/CD --- .codefresh/codefresh.yaml | 44 +++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 46 insertions(+) create mode 100644 .codefresh/codefresh.yaml diff --git a/.codefresh/codefresh.yaml b/.codefresh/codefresh.yaml new file mode 100644 index 00000000..f1f2ebf0 --- /dev/null +++ b/.codefresh/codefresh.yaml @@ -0,0 +1,44 @@ +# More examples of Codefresh YAML can be found at +# https://codefresh.io/docs/docs/yaml-examples/examples/ + +version: "1.0" +# Stages can help you organize your steps in stages +stages: + - "clone" + - "build" + - "promote" + +steps: + clone: + title: "Cloning repository" + type: "git-clone" + repo: "todaywasawesome/kube-plex" + # CF_BRANCH value is auto set when pipeline is triggered + # Learn more at codefresh.io/docs/docs/codefresh-yaml/variables/ + revision: "${{CF_BRANCH}}" + git: "github" + stage: "clone" + + geterdone: + title: "Build and Test" + type: parallel + stage: "build" + steps: + build: + title: "Building Docker image" + type: "build" + image_name: "todaywasawesome/kube-plex" + working_directory: "${{clone}}" + tag: "${{CF_BRANCH_TAG_NORMALIZED}}" + dockerfile: "Dockerfile" + stage: "build" + + push: + type: push + arguments: + candidate: '${{build}}' + tag: latest + image_name: "todaywasawesome/kube-plex" + registry: todaywasawesome + stage: "promote" + diff --git a/README.md b/README.md index 36c86993..3fdc4077 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/todaywasawesome/Atomic%20Cluster%2FPlex-kube?key=eyJhbGciOiJIUzI1NiJ9.NTgxYjcxMzk4MDM4OWEwMTAwZDFlNzkw.u79dSG8wLg7iLl47YDrhp31p_1ZnJv6HwJ198otYd7k&type=cf-1)]( https%3A%2F%2Fg.codefresh.io%2Fpipelines%2FPlex-kube%2Fbuilds%3Ffilter%3Dtrigger%3Abuild~Build%3Bpipeline%3A5e913ece618642555e116db3~Plex-kube) + # kube-plex kube-plex is a scalable Plex Media Server solution for Kubernetes. It From 04f72694630566deb9fb4855db88fd3f27f5bcfa Mon Sep 17 00:00:00 2001 From: Dan Garfield Date: Wed, 17 Jun 2020 11:13:42 -0600 Subject: [PATCH 3/3] remove Codefresh stuff for PR --- .codefresh/codefresh.yaml | 44 --------------------------------------- README.md | 2 -- 2 files changed, 46 deletions(-) delete mode 100644 .codefresh/codefresh.yaml diff --git a/.codefresh/codefresh.yaml b/.codefresh/codefresh.yaml deleted file mode 100644 index f1f2ebf0..00000000 --- a/.codefresh/codefresh.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# More examples of Codefresh YAML can be found at -# https://codefresh.io/docs/docs/yaml-examples/examples/ - -version: "1.0" -# Stages can help you organize your steps in stages -stages: - - "clone" - - "build" - - "promote" - -steps: - clone: - title: "Cloning repository" - type: "git-clone" - repo: "todaywasawesome/kube-plex" - # CF_BRANCH value is auto set when pipeline is triggered - # Learn more at codefresh.io/docs/docs/codefresh-yaml/variables/ - revision: "${{CF_BRANCH}}" - git: "github" - stage: "clone" - - geterdone: - title: "Build and Test" - type: parallel - stage: "build" - steps: - build: - title: "Building Docker image" - type: "build" - image_name: "todaywasawesome/kube-plex" - working_directory: "${{clone}}" - tag: "${{CF_BRANCH_TAG_NORMALIZED}}" - dockerfile: "Dockerfile" - stage: "build" - - push: - type: push - arguments: - candidate: '${{build}}' - tag: latest - image_name: "todaywasawesome/kube-plex" - registry: todaywasawesome - stage: "promote" - diff --git a/README.md b/README.md index 3fdc4077..36c86993 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/todaywasawesome/Atomic%20Cluster%2FPlex-kube?key=eyJhbGciOiJIUzI1NiJ9.NTgxYjcxMzk4MDM4OWEwMTAwZDFlNzkw.u79dSG8wLg7iLl47YDrhp31p_1ZnJv6HwJ198otYd7k&type=cf-1)]( https%3A%2F%2Fg.codefresh.io%2Fpipelines%2FPlex-kube%2Fbuilds%3Ffilter%3Dtrigger%3Abuild~Build%3Bpipeline%3A5e913ece618642555e116db3~Plex-kube) - # kube-plex kube-plex is a scalable Plex Media Server solution for Kubernetes. It