-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract dockerfile content to standalone files
- Loading branch information
Showing
5 changed files
with
51 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Please modify your template according to your business needs!!! | ||
|
||
FROM golang:alpine AS builder | ||
|
||
LABEL stage=gobuilder | ||
|
||
ENV CGO_ENABLED 0 | ||
ENV GOPROXY https://goproxy.cn,direct | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | ||
|
||
WORKDIR /build | ||
|
||
ADD go.mod . | ||
ADD go.sum . | ||
RUN go mod download | ||
COPY . . | ||
COPY ./conf /app/conf | ||
RUN go build -ldflags="-s -w" -trimpath -o /app/dubbogo ./cmd | ||
|
||
FROM scratch | ||
|
||
WORKDIR /app | ||
COPY --from=builder /app/dubbogo /app/dubbogo | ||
COPY --from=builder /app/conf /app/conf | ||
ENV DUBBO_GO_CONFIG_PATH=/app/conf/dubbogo.yaml | ||
|
||
CMD ["./dubbogo"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Please modify your template according to your business needs!!! | ||
|
||
FROM openjdk:8-jdk-alpine | ||
|
||
ADD target/demo-0.0.1-SNAPSHOT.jar app.jar | ||
ENV JAVA_OPTS="" | ||
ENTRYPOINT exec java $JAVA_OPTS -jar /app.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters