4
这样的微服务目录结构该如何优雅地编译
source link: https://www.v2ex.com/t/778701
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
项目目录,app1 和 2 均引用了 library 的包
-
project
- go.mod
- go.sum
- docker-compose.yml
-
app1
- Dockerfile
-
app2
- Dockerfile
-
library
- tool1
- tool2
Dockerfile 长这样
FROM golang:latest as build
COPY . /data/
WORKDIR /data/
RUN go build -o dist/main cmd/main.go
FROM scratch
WORKDIR /app
EXPOSE 80
CMD ["./main"]
这样 docker-compose 编辑 Dockerfile 的话会报找不到 library 的引用,因为没有 copy 进来。但是好像 Dockerfile 的 copy 不能 copy 上级目录的东西。
所以现在的问题是如何能够优雅地编译微服务?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK