-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ef3ae4
commit eaca414
Showing
12 changed files
with
242 additions
and
1 deletion.
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,9 @@ | ||
FROM golang:latest | ||
RUN mkdir /app | ||
ADD . /app/ | ||
WORKDIR /app | ||
RUN go get -d | ||
RUN go build -o main . | ||
RUN echo "Hello-world" | ||
CMD ["/app/main"] | ||
EXPOSE 80 |
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 +1,6 @@ | ||
# go-sample | ||
| -------- | --------|--------| | ||
| Go Lang | Azure Web App, Virtual Machine, AKS| | | ||
|
||
# Sample Go web application | ||
|
||
This is a sample GO Lang web application that you can deploy to Azure. |
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,58 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"html/template" | ||
"log" | ||
"net/http" | ||
"os" | ||
"github.com/Microsoft/ApplicationInsights-Go/appinsights" | ||
) | ||
|
||
type PageVars struct { | ||
Message string | ||
Language string | ||
} | ||
|
||
func main() { | ||
client := appinsights.NewTelemetryClient(os.Getenv("APPINSIGHTS_INSTRUMENTATIONKEY")) | ||
request := appinsights.NewRequestTelemetry("GET", "https://myapp.azurewebsites.net/", 1 , "Success") | ||
client.Track(request) | ||
http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css")))) | ||
http.Handle("/img/", http.StripPrefix("/img/", http.FileServer(http.Dir("img")))) | ||
http.Handle("/fonts/", http.StripPrefix("/fonts/", http.FileServer(http.Dir("fonts")))) | ||
http.HandleFunc("/", Home) | ||
log.Fatal(http.ListenAndServe(getPort(), nil)) | ||
} | ||
|
||
func getPort() string { | ||
p := os.Getenv("HTTP_PLATFORM_PORT") | ||
if p != "" { | ||
return ":" + p | ||
} | ||
return ":80" | ||
} | ||
|
||
func render(w http.ResponseWriter, tmpl string, pageVars PageVars) { | ||
|
||
tmpl = fmt.Sprintf("views/%s", tmpl) | ||
t, err := template.ParseFiles(tmpl) | ||
|
||
if err != nil { // if there is an error | ||
log.Print("template parsing error: ", err) // log it | ||
} | ||
|
||
err = t.Execute(w, pageVars) //execute the template and pass in the variables to fill the gaps | ||
|
||
if err != nil { // if there is an error | ||
log.Print("template executing error: ", err) //log it | ||
} | ||
} | ||
|
||
func Home(w http.ResponseWriter, req *http.Request) { | ||
pageVars := PageVars{ | ||
Message: "Success!", | ||
Language: "Go Lang", | ||
} | ||
render(w, "index.html", pageVars) | ||
} |
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,134 @@ | ||
html, | ||
body { | ||
height: 100%; | ||
width: 100%; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
@font-face{ | ||
font-family: "Segoe UI"; | ||
src: url('../fonts/segoeuil.ttf'); | ||
} | ||
.main-container { | ||
height: 100%; | ||
width: 100%; | ||
background-color: #1d539d; | ||
color: white; | ||
padding-top: 6%; | ||
box-sizing: border-box; | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
font-family: "Segoe UI"; | ||
} | ||
|
||
.cloud-image { | ||
width: 1200px; | ||
height: 250px; | ||
padding-bottom: 50px; | ||
margin: auto; | ||
} | ||
|
||
.success-text { | ||
padding-bottom: 20px; | ||
font-size: 62px; | ||
line-height: 73px; | ||
} | ||
|
||
.description { | ||
font-size: 34px; | ||
line-height: 40px; | ||
} | ||
|
||
.next-steps-container { | ||
padding-top: 50px; | ||
} | ||
|
||
.next-steps-header { | ||
font-size: 24px; | ||
line-height: 28px; | ||
padding-bottom: 25px; | ||
} | ||
|
||
.next-steps-body { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.step { | ||
display: flex; | ||
margin: 7px 0px; | ||
font-size: 15px; | ||
line-height: 21px; | ||
} | ||
|
||
.step-icon { | ||
height: 20px; | ||
width: 20px; | ||
margin-right: 10px; | ||
} | ||
|
||
.step-text a { | ||
color: white; | ||
text-decoration: none; | ||
} | ||
|
||
.step-text a:hover { | ||
color: white; | ||
text-decoration:underline; | ||
} | ||
|
||
.content { | ||
box-sizing: border-box; | ||
min-width: 700px; | ||
max-width: 830px; | ||
position: relative; | ||
margin: auto; | ||
} | ||
|
||
.tweet-container { | ||
min-width: 30px; | ||
min-height: 100px; | ||
margin: 0 20px; | ||
position: absolute; | ||
left: -100px; | ||
top: 110px; | ||
} | ||
.content-body{ | ||
min-width: 400px; | ||
} | ||
|
||
@media (max-width: 1024px) { | ||
.main-container{ | ||
padding-top: 1%; | ||
} | ||
.cloud-image { | ||
padding-bottom: 30px; | ||
} | ||
.next-steps-container { | ||
padding-top: 30px; | ||
} | ||
.next-steps-header { | ||
padding-bottom: 20px; | ||
} | ||
.success-text { | ||
font-size: 50px; | ||
line-height: 61px; | ||
padding-bottom: 10px; | ||
} | ||
.description { | ||
font-size: 26px; | ||
line-height: 30px; | ||
} | ||
|
||
.step { | ||
font-size: 12px; | ||
line-height: 18px; | ||
} | ||
.tweet-container { | ||
top: 80px; | ||
} | ||
.content{ | ||
max-width: 630px; | ||
min-width: 630px; | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,29 @@ | ||
<!Doctype html> | ||
<html> | ||
|
||
<head> | ||
<title>Go Lang Application</title> | ||
<link href="css/site.css" rel="stylesheet"> | ||
</head> | ||
|
||
<body> | ||
<div class="main-container"> | ||
<div class="cloud-image"> | ||
<img src="img/successCloudNew.svg" /> | ||
</div> | ||
<div class="content"> | ||
<div class="tweet-container"> | ||
<a href="http://twitter.com/intent/tweet/?text=I%20just%20created%20a%20new%20Go%20webapp%20on%20Azure%20using%20Azure%20DevOps%20Project&hashtags=AzureDevOpsProject%2CVSTS%20%40Azure%20%40VSTS"> | ||
<img src="img/tweetThis.svg" /> | ||
</a> | ||
</div> | ||
<div class="content-body"> | ||
<div class="success-text">{{.Message}}</div> | ||
<div class="description line-2"> Your {{.Language}} app is up and running</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |