4. Multi-Stage Dockerfiles
Activity 4.01: Deploying a Golang HTTP Server with a Multi-Stage Docker Build
Solution:
- Create a new directory named
activity-04-01
for this activity:mkdir activity-04-01
- Navigate to the newly created
activity-04-01
directory:cd activity-04-01
- Within the
activity-04-01
directory, create a file namedmain.go
:$ touch main.go
- Now, open the
main.go
file using your favorite text editor:$ vim main.go
- Add the following content to the
main.go
file, and then save and exit this file:package main import ( "net/http" "fmt" "log" "os" ) func main() { http.HandleFunc("/", defaultHandler) http.HandleFunc("/contact", contactHandler) http.HandleFunc("/login", loginHandler) port := os.Getenv...