diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..55083c9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.github + +datetime + +data/cities*.json diff --git a/.gitignore b/.gitignore index 5d1c099..906fa4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ datetime* -templates/icon_*.svg data/cities*.json diff --git a/Dockerfile b/Dockerfile index 8c0b238..b84c660 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,20 @@ -FROM golang:1.15-alpine +FROM golang:1.15-alpine3.12 AS build + +RUN apk add \ + make WORKDIR /go/src/app COPY . . RUN make + + +FROM alpine:3.12 + +WORKDIR /app +COPY --from=build /go/src/app/assets assets +COPY --from=build /go/src/app/templates templates +COPY --from=build /go/src/app/data/cities.json data/ +COPY --from=build /go/src/app/datetime . + +CMD ["./datetime"] diff --git a/main.go b/main.go index fcb736c..f248385 100644 --- a/main.go +++ b/main.go @@ -28,10 +28,10 @@ func main() { panic(err) } + http.Handle("/data/", http.FileServer(http.Dir("."))) http.Handle("/js/", http.FileServer(http.Dir("assets"))) http.Handle("/css/", http.FileServer(http.Dir("assets"))) http.Handle("/favicon.ico", http.FileServer(http.Dir("assets"))) - http.Handle("/data", http.FileServer(http.Dir("data"))) http.HandleFunc("/", index) log.Printf("Listening on %v", server.Addr) diff --git a/templates/icon_solid_adjust.svg b/templates/icon_solid_adjust.svg new file mode 100644 index 0000000..8dc2998 --- /dev/null +++ b/templates/icon_solid_adjust.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/icon_solid_moon.svg b/templates/icon_solid_moon.svg new file mode 100644 index 0000000..45d4411 --- /dev/null +++ b/templates/icon_solid_moon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/icon_solid_sun.svg b/templates/icon_solid_sun.svg new file mode 100644 index 0000000..6122eb6 --- /dev/null +++ b/templates/icon_solid_sun.svg @@ -0,0 +1 @@ + \ No newline at end of file