1
0
Fork 0

Initial Dockerfile

main
Ambrose Chua 2020-11-08 00:11:38 +08:00
parent 3516b04f23
commit 2c1943f538
7 changed files with 25 additions and 3 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
.git
.github
datetime
data/cities*.json

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
datetime*
templates/icon_*.svg
data/cities*.json

View File

@ -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"]

View File

@ -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)

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M8 256c0 136.966 111.033 248 248 248s248-111.034 248-248S392.966 8 256 8 8 119.033 8 256zm248 184V72c101.705 0 184 82.311 184 184 0 101.705-82.311 184-184 184z"/></svg>

After

Width:  |  Height:  |  Size: 419 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"/></svg>

After

Width:  |  Height:  |  Size: 563 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"/></svg>

After

Width:  |  Height:  |  Size: 847 B