fix docker

This commit is contained in:
liangzai 2025-06-08 15:19:15 +08:00
parent e75c7b3dd3
commit 9344532b24
3 changed files with 85 additions and 86 deletions

View File

@ -14,8 +14,8 @@ ADD go.mod .
ADD go.sum . ADD go.sum .
RUN go mod download RUN go mod download
COPY . . COPY . .
COPY app/user/cmd/api/etc /app/etc COPY app/main/api/etc /app/etc
RUN go build -ldflags="-s -w" -o /app/main app/main/cmd/api/main.go RUN go build -ldflags="-s -w" -o /app/main app/main/api/main.go
FROM scratch FROM scratch

View File

@ -26,7 +26,7 @@ func main() {
// 根据 ENV 加载不同的配置文件 // 根据 ENV 加载不同的配置文件
var defaultConfigFile string var defaultConfigFile string
if env == "development" { if env == "development" {
defaultConfigFile = "app/main/cmd/api/etc/main.dev.yaml" defaultConfigFile = "app/main/api/etc/main.dev.yaml"
} else { } else {
defaultConfigFile = "etc/main.yaml" defaultConfigFile = "etc/main.yaml"
} }

View File

@ -1,7 +1,6 @@
version: '3' version: "3"
services: services:
mysql: mysql:
image: mysql:8.0.34 image: mysql:8.0.34
container_name: tydata_mysql container_name: tydata_mysql
@ -58,8 +57,8 @@ services:
environment: environment:
- TZ=Asia/Shanghai - TZ=Asia/Shanghai
command: command:
- '--redis-addr=tydata_redis:6379' - "--redis-addr=tydata_redis:6379"
- '--redis-password=3m3WsgyCKWqz' - "--redis-password=3m3WsgyCKWqz"
restart: always restart: always
networks: networks:
- tydata_net - tydata_net
@ -70,7 +69,7 @@ services:
container_name: tydata_main container_name: tydata_main
build: build:
context: . context: .
dockerfile: app/main/cmd/api/Dockerfile dockerfile: app/main/api/Dockerfile
ports: ports:
- "21004:8888" - "21004:8888"
environment: environment: