Upgrade v1.3.0

1. Add CORS config file;
2. Add Dockerfile;
This commit is contained in:
Bowens
2022-10-30 16:32:43 +08:00
parent 51ca3a2885
commit 7960632b8e
5 changed files with 50 additions and 3 deletions

23
Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
FROM golang:1.18.3-alpine3.16 AS builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOARCH="amd64" \
GOOS=linux
WORKDIR /build
COPY . .
RUN go mod tidy
RUN go build --ldflags "-extldflags -static" -o main .
FROM alpine:3.16
WORKDIR /www
COPY --from=builder /build/main /www/
COPY --from=builder /build/database/ /www/database/
COPY --from=builder /build/public/ /www/public/
COPY --from=builder /build/storage/ /www/storage/
COPY --from=builder /build/.env /www/.env
ENTRYPOINT ["/www/main"]

View File

@@ -34,7 +34,7 @@ Golang developers quickly build their own applications.
- [ ] Orm relationships
- [ ] Request validator
- [ ] Custom .env path
- [ ] Config cors
- [ ] Authorization
## Documentation

View File

@@ -32,7 +32,7 @@ Goravel 是一个功能完备、具有良好扩展能力的 Web 应用程序框
- [ ] Orm 关联关系
- [ ] Request 校验
- [ ] 自定义 .env 路径
- [ ] Config cors
- [ ] 用户授权
## 文档

24
config/cors.go Normal file
View File

@@ -0,0 +1,24 @@
package config
import (
"github.com/goravel/framework/facades"
)
func init() {
config := facades.Config
config.Add("cors", map[string]interface{}{
//Cross-Origin Resource Sharing (CORS) Configuration
//
//Here you may configure your settings for cross-origin resource sharing
//or "CORS". This determines what cross-origin operations may execute
//in web browsers. You are free to adjust these settings as needed.
//
//To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
"allowed_methods": []string{"*"},
"allowed_origins": []string{"*"},
"allowed_headers": []string{"*"},
"exposed_headers": []string{"*"},
"max_age": 0,
"supports_credentials": false,
})
}

2
go.mod
View File

@@ -2,7 +2,7 @@ module goravel
go 1.18
require github.com/goravel/framework v1.2.3
require github.com/goravel/framework v1.3.0
require (
cloud.google.com/go v0.100.2 // indirect