Now that Jenkins has been configured, we need to decide on an application to configure and deploy.
If you recall, in Chapter 4, Optimizing Docker Images, we created a simple Go application, which prints hello world
to the screen when you open it in a browser. Dockerfile
contained a multi-stage build that looked like the following:
FROM golang:1.11-stretch ADD hello.go hello.go RUN go build hello.go FROM busybox COPY --from=0 /go/hello /app/hello COPY --from=0 /lib/x86_64-linux-gnu/libpthread.so.0 \ /lib/x86_64-linux-gnu/libpthread.so.0 COPY --from=0 /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6 COPY --from=0 /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 WORKDIR /app EXPOSE 8080 ENTRYPOINT ["./hello"]
The hello.go
file contains the following:
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "hello world")
}
func main() ...