mirror of
https://github.com/goravel/goravel.git
synced 2025-09-26 20:51:19 +08:00
Upgrade v1.3.0
1. Add CORS config file; 2. Add Dockerfile;
This commit is contained in:
23
Dockerfile
Normal file
23
Dockerfile
Normal 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"]
|
@@ -34,7 +34,7 @@ Golang developers quickly build their own applications.
|
|||||||
- [ ] Orm relationships
|
- [ ] Orm relationships
|
||||||
- [ ] Request validator
|
- [ ] Request validator
|
||||||
- [ ] Custom .env path
|
- [ ] Custom .env path
|
||||||
- [ ] Config cors
|
- [ ] Authorization
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ Goravel 是一个功能完备、具有良好扩展能力的 Web 应用程序框
|
|||||||
- [ ] Orm 关联关系
|
- [ ] Orm 关联关系
|
||||||
- [ ] Request 校验
|
- [ ] Request 校验
|
||||||
- [ ] 自定义 .env 路径
|
- [ ] 自定义 .env 路径
|
||||||
- [ ] Config cors
|
- [ ] 用户授权
|
||||||
|
|
||||||
## 文档
|
## 文档
|
||||||
|
|
||||||
|
24
config/cors.go
Normal file
24
config/cors.go
Normal 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,
|
||||||
|
})
|
||||||
|
}
|
Reference in New Issue
Block a user