Skip to content

Commit

Permalink
build docker image the correct way lol
Browse files Browse the repository at this point in the history
  • Loading branch information
kujov committed Feb 28, 2024
1 parent 8558e05 commit 3f6e715
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM golang:1.21
FROM golang:1.21 as builder

WORKDIR /app

COPY . .

RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o gosubscriber ./main.go

EXPOSE 8080
FROM debian:bullseye-slim

WORKDIR /app

RUN GOOS=linux GOARCH=amd64 go build -o ./gosubscriber ./main.go
COPY --from=builder /app/gosubscriber .

EXPOSE 8080

CMD ["go", "run", "."]
CMD ["./gosubscriber"]

0 comments on commit 3f6e715

Please sign in to comment.