Skip to content

Commit

Permalink
Update stat_consumer build
Browse files Browse the repository at this point in the history
  • Loading branch information
ale8k committed Dec 5, 2021
1 parent 80dc4f4 commit 0adaf19
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions stat_consumer/Dockerfile
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"]

0 comments on commit 0adaf19

Please sign in to comment.