Complete addition of GET option. Build container.
This commit is contained in:
parent
99a1a25254
commit
9007e7e916
@ -6,8 +6,10 @@ RUN go test ./...
|
|||||||
RUN CGO_ENABLED=0 go build .
|
RUN CGO_ENABLED=0 go build .
|
||||||
|
|
||||||
# Final stage
|
# Final stage
|
||||||
|
#FROM gcr.io/distroless/static
|
||||||
FROM scratch
|
FROM scratch
|
||||||
EXPOSE 8500
|
EXPOSE 8500
|
||||||
|
WORKDIR /bin
|
||||||
COPY --from=build /build/templates /bin/templates
|
COPY --from=build /build/templates /bin/templates
|
||||||
COPY --from=build /build/static /bin/static
|
COPY --from=build /build/static /bin/static
|
||||||
COPY --from=build /build/barcodes /bin/barcodes
|
COPY --from=build /build/barcodes /bin/barcodes
|
||||||
|
2
main.go
2
main.go
@ -7,6 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Starting `barcodes` server")
|
fmt.Println("Starting `barcodes` server (Version 0.0.1-alpha)")
|
||||||
web.StartServer()
|
web.StartServer()
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func helpTemplate(w http.ResponseWriter, r *http.Request) {
|
|||||||
BarcodeOptions: barcodeOptions,
|
BarcodeOptions: barcodeOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles("templates/base.html", "templates/help.html")
|
tmpl, err := template.ParseFiles("./templates/base.html", "./templates/help.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error parsing templates: ", err)
|
fmt.Println("Error parsing templates: ", err)
|
||||||
http.Error(w, "Unable to parse templates", 500)
|
http.Error(w, "Unable to parse templates", 500)
|
||||||
|
@ -15,7 +15,7 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
templatePath := "templates" + path + ".html"
|
templatePath := "templates" + path + ".html"
|
||||||
if _, err := os.Stat(templatePath); err == nil {
|
if _, err := os.Stat(templatePath); err == nil {
|
||||||
tmpl, err := template.ParseFiles("templates/base.html", templatePath)
|
tmpl, err := template.ParseFiles("./templates/base.html", "./"+templatePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error parsing template: ", err)
|
fmt.Println("Error parsing template: ", err)
|
||||||
http.Error(w, "Error parsing template", http.StatusInternalServerError)
|
http.Error(w, "Error parsing template", http.StatusInternalServerError)
|
||||||
|
Loading…
Reference in New Issue
Block a user