File tree Expand file tree Collapse file tree 6 files changed +111
-0
lines changed Expand file tree Collapse file tree 6 files changed +111
-0
lines changed Original file line number Diff line number Diff line change 1+ # Compiled Object files, Static and Dynamic libs (Shared Objects)
2+ * .o
3+ * .a
4+ * .so
5+
6+ # Folders
7+ _obj
8+ _test
9+ bin
10+
11+ # Architecture specific extensions/prefixes
12+ * . [568vq ]
13+ [568vq ].out
14+
15+ * .cgo1.go
16+ * .cgo2.c
17+ _cgo_defun.c
18+ _cgo_gotypes.go
19+ _cgo_export. *
20+
21+ _testmain.go
22+
23+ * .exe
24+ * .test
25+ * .prof
Original file line number Diff line number Diff line change 1+ FROM golang:1.15.1-alpine3.12 AS build-env
2+
3+ WORKDIR /tmp/simple-go-app
4+
5+ COPY . .
6+
7+ RUN CGO_ENABLED=0 GOOS=linux go build
8+
9+ FROM scratch
10+ COPY --from=build-env /tmp/simple-go-app/simple-web-app /app/simple-web-app
11+
12+ EXPOSE 8080
13+ CMD ["/app/simple-web-app" ]
Original file line number Diff line number Diff line change 1+ # A sample GO web application with Dockerfile
2+
3+ See also https://github.com/kostis-codefresh/simple-kubernetes-deployment
4+
Original file line number Diff line number Diff line change 1+ version : " 1.0"
2+ stages :
3+ - " clone"
4+ - " build"
5+ - " metadata"
6+
7+ steps :
8+ clone :
9+ title : " Cloning repository"
10+ type : " git-clone"
11+ repo : " kostis-codefresh/simple-web-app"
12+ revision : ' ${{CF_REVISION}}'
13+ stage : " clone"
14+
15+ build :
16+ title : " Building Docker image"
17+ type : " build"
18+ image_name : " kostiscodefresh/simple-web-app"
19+ working_directory : " ${{clone}}"
20+ tags :
21+ - " latest"
22+ - ' ${{CF_SHORT_REVISION}}'
23+ dockerfile : " Dockerfile"
24+ stage : " build"
25+ registry : dockerhub
26+ get_step_info :
27+ title : Get Github token
28+ stage : " metadata"
29+ image : ' codefresh/cli'
30+ commands :
31+ - cf_export GITHUB_TOKEN=$(codefresh get context github-1 --decrypt -o yaml | yq -y .spec.data.auth.password)
32+ enrich-image :
33+ title : Add PR info
34+ type : image-enricher
35+ stage : " metadata"
36+ arguments :
37+ IMAGE : docker.io/kostiscodefresh/simple-web-app:latest
38+ BRANCH : ' ${{CF_BRANCH}}'
39+ REPO : ' kostis-codefresh/simple-web-app'
40+ GITHUB_TOKEN : ' ${{GITHUB_TOKEN}}'
41+
42+
43+
Original file line number Diff line number Diff line change 1+ module github.com/kostis-codefresh/simple-web-app
2+
3+ go 1.13
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ "net/http"
6+ )
7+
8+ func indexHandler (w http.ResponseWriter , r * http.Request ) {
9+ fmt .Fprintf (w , "I am a GO application running inside Docker." )
10+
11+ }
12+
13+ func healthHandler (w http.ResponseWriter , r * http.Request ) {
14+ fmt .Fprintf (w , "OK\n " )
15+
16+ }
17+
18+ func main () {
19+ fmt .Println ("Simple web server is starting on port 8080..." )
20+ http .HandleFunc ("/" , indexHandler )
21+ http .HandleFunc ("/health" , healthHandler )
22+ http .ListenAndServe (":8080" , nil )
23+ }
You can’t perform that action at this time.
0 commit comments