File tree 4 files changed +72
-0
lines changed
4 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM golang:latest
2
+
3
+ RUN mkdir /app
4
+
5
+ ADD . /app
6
+
7
+ WORKDIR /app
8
+
9
+ RUN go build -o teste .
10
+
11
+ CMD ["/app/teste" ]
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="pt-BR ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 ">
6
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7
+ < meta http-equiv ="X-UA-Compatible " content ="ie=edge ">
8
+ < title > {{.Titulo}}</ title >
9
+ </ head >
10
+
11
+ < body >
12
+ {{.Titulo}}
13
+ </ body >
14
+
15
+ </ html >
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "net/http"
6
+ "text/template"
7
+ )
8
+
9
+ type home struct {
10
+ Titulo string
11
+ Request string
12
+ }
13
+
14
+ func helloWorld (res http.ResponseWriter , req * http.Request ) {
15
+ tmpl := template .Must (template .ParseFiles ("index.html" ))
16
+
17
+ h := home {
18
+ Titulo : "Testando Golang e Docker" ,
19
+ }
20
+
21
+ fmt .Println (req )
22
+
23
+ tmpl .Execute (res , h )
24
+ }
25
+
26
+ func main () {
27
+ http .HandleFunc ("/" , helloWorld )
28
+ http .ListenAndServe (":3000" , nil )
29
+ }
Original file line number Diff line number Diff line change
1
+ <p align =" center " >
2
+ <img width =" 460 " height =" 300 " src =" https://www.mundodocker.com.br/wp-content/uploads/2015/06/docker_facebook_share.png " >
3
+ </p >
4
+
5
+ # Criação e Execução da imagem
6
+ #### GoLang
7
+ > Para executar o teste execute os comandos abaixo
8
+
9
+ 1 . Criar a imagem ``` docker build -t luizfilipy/app . ```
10
+ 2 . Executar imagem ``` docker run -p 3001:3000 -d luizfilipy/app ```
11
+
12
+ # Comandos úteis
13
+ * Ver os processos em execução ``` docker ps ```
14
+ * Parar a execução de uma imagem ``` docker stop {CONTAINER ID} ```
15
+ * Apagar todas as imagens ``` docker system prune -a ```
16
+
17
+ [ :whale : Veja a lista completa :whale : ] ( https://docs.docker.com/engine/reference/commandline/docker/ )
You can’t perform that action at this time.
0 commit comments