-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b31ef4
commit 30361bd
Showing
1 changed file
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM golang:1.22.5-alpine3.20 AS base | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
COPY pkg/httpserver ./pkg/httpserver/ | ||
COPY cmd/httpserver/main.go ./cmd/httpserver/ | ||
|
||
COPY pkg/ginserver ./pkg/ginserver/ | ||
COPY cmd/ginserver/main.go ./cmd/ginserver/ | ||
|
||
ENV PORT=8080 | ||
|
||
RUN go mod download | ||
|
||
FROM base AS build-http | ||
RUN go build -o /bin/httpserver ./cmd/httpserver | ||
|
||
|
||
FROM base AS build-gin | ||
RUN go build -o /bin/ginserver ./cmd/ginserver | ||
|
||
|
||
FROM scratch AS http | ||
COPY --from=build-http /bin/httpserver /cmd/ | ||
|
||
ENTRYPOINT [ "/bin/httpserver" ] | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["./main"] | ||
|
||
FROM scratch AS gin | ||
COPY --from=build-gin /bin/ginserver /cmd/ | ||
|
||
ENTRYPOINT [ "/bin/ginserver" ] | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["./main"] |