smol fixups
parent
d08447208e
commit
79faa3a735
|
@ -1 +1,2 @@
|
|||
frontend
|
||||
node_modules
|
||||
|
|
|
@ -2,19 +2,17 @@
|
|||
FROM golang as build
|
||||
WORKDIR /go/src/microsrv
|
||||
COPY . .
|
||||
#RUN apk update
|
||||
#RUN apk add git
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOOS linux
|
||||
ENV GOARCH amd64
|
||||
RUN go get -d -v ./...
|
||||
RUN go build -v -ldflags '-extldflags "-static"' ./...
|
||||
RUN go install -v ./...
|
||||
|
||||
# run
|
||||
FROM busybox
|
||||
FROM busybox:glibc
|
||||
RUN adduser -D -u 5000 app
|
||||
USER app:app
|
||||
WORKDIR /go/bin/
|
||||
ENV GOPATH /go
|
||||
COPY --from=build /go/bin/microsrv /go/bin/microsrv
|
||||
EXPOSE 9090
|
||||
CMD ["/go/bin/microsrv"]
|
||||
|
|
6
main.go
6
main.go
|
@ -3,8 +3,8 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/gorilla/mux"
|
||||
gohandlers "github.com/gorilla/handlers"
|
||||
"github.com/gorilla/mux"
|
||||
"log"
|
||||
"microsrv/data"
|
||||
"microsrv/handlers"
|
||||
|
@ -19,8 +19,8 @@ func main() {
|
|||
v := data.NewValidation()
|
||||
redocOpts := middleware.RedocOpts{SpecURL: "/swagger.yml"} //Redoc option to use YAML instead of JSON
|
||||
|
||||
ph := handlers.NewProducts(l, v) //Product handler
|
||||
sh := middleware.Redoc(redocOpts, nil) //Swagger handler
|
||||
ph := handlers.NewProducts(l, v) //Product handler
|
||||
sh := middleware.Redoc(redocOpts, nil) //Swagger handler
|
||||
ch := gohandlers.CORS(gohandlers.AllowedOrigins([]string{"*"})) //CORS handler
|
||||
|
||||
//responseweriter and request get passed automatically to the function in HandleFunc
|
||||
|
|
Loading…
Reference in New Issue