-
Notifications
You must be signed in to change notification settings - Fork 0
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
ale8k
committed
Dec 5, 2021
1 parent
80dc4f4
commit 0adaf19
Showing
1 changed file
with
25 additions
and
21 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 |
---|---|---|
@@ -1,29 +1,33 @@ | ||
######## | ||
# BASE # | ||
######## | ||
FROM golang:1.17.3 AS base | ||
WORKDIR /usr/src/app | ||
|
||
####### | ||
# DEV # | ||
####### | ||
FROM base AS dev | ||
WORKDIR /usr/src/app | ||
RUN go get -u github.com/cosmtrek/air && go install github.com/go-delve/delve/cmd/dlv@latest | ||
EXPOSE 9000 | ||
EXPOSE 2345 | ||
|
||
######### | ||
# BUILD # | ||
######### | ||
FROM golang:1.17.3 AS build | ||
|
||
FROM base AS build | ||
WORKDIR /usr/src/app | ||
|
||
COPY ./go.mod ./ | ||
COPY ./go.sum ./ | ||
COPY ./*.go ./ | ||
|
||
RUN go mod download | ||
RUN mkdir ./build | ||
RUN go build -o ./app | ||
RUN go build -o ./statconsumer | ||
|
||
####### | ||
# RUN # | ||
####### | ||
######## | ||
# PROD # | ||
######## | ||
FROM alpine:3.15 | ||
|
||
WORKDIR /app | ||
|
||
EXPOSE 8000 | ||
|
||
COPY --from=build /usr/src/app /app | ||
|
||
RUN chmod +x /app/app | ||
|
||
ENTRYPOINT ["/app/app"] | ||
WORKDIR /usr/src/app | ||
EXPOSE 9000 | ||
COPY --from=build /usr/src/app/statconsumer /usr/src/app/statconsumer | ||
RUN chmod +x /usr/src/app/statconsumer | ||
ENTRYPOINT ["/usr/src/app/statconsumer"] |