Skip to content

Commit

Permalink
feat: multistage docker for gin server
Browse files Browse the repository at this point in the history
  • Loading branch information
RawanMostafa08 committed Sep 21, 2024
1 parent a51b0cf commit 13031c6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Dockerfile.gin
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
FROM golang:latest AS builder
WORKDIR /app

WORKDIR /build

COPY . .

RUN go mod download
RUN go build -o ginserver ./cmd/ginserver/main.go

RUN CGO_ENABLED=0 GOOS=linux go build -o ginout ./cmd/ginserver/main.go

EXPOSE 8083

ENTRYPOINT [ "/app/ginserver" ]

FROM scratch
WORKDIR /app
COPY --from=builder /build/ginout .

ENTRYPOINT [ "/app/ginout" ]

0 comments on commit 13031c6

Please sign in to comment.