Skip to content

Commit

Permalink
use docker multi-stage build
Browse files Browse the repository at this point in the history
  • Loading branch information
Eslam-Nawara committed Oct 24, 2023
1 parent f26bba3 commit 986ae33
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions user-contracts-mon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
FROM golang:1.21-alpine
FROM golang:1.21-alpine as builder

WORKDIR /contracts-mon-bot
WORKDIR /src

COPY . .

WORKDIR /contracts-mon-bot/user-contracts-mon
WORKDIR /src/user-contracts-mon

RUN go mod tidy
RUN go mod tidy

RUN go build -o contractsmon main.go


FROM alpine

WORKDIR /app

COPY --from=builder /src/user-contracts-mon/contractsmon .

COPY --from=builder /src/user-contracts-mon/.env .

CMD ./contractsmon -e .env

0 comments on commit 986ae33

Please # to comment.