Skip to content

Commit

Permalink
feat: multistage docker for http server
Browse files Browse the repository at this point in the history
  • Loading branch information
RawanMostafa08 committed Sep 21, 2024
1 parent 6baa94c commit a51b0cf
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Dockerfile.http
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 httpserver ./cmd/httpserver/main.go

RUN CGO_ENABLED=0 GOOS=linux go build -o httpout ./cmd/httpserver/main.go

EXPOSE 8080

ENTRYPOINT [ "/app/httpserver" ]

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

ENTRYPOINT [ "/app/httpout" ]

0 comments on commit a51b0cf

Please sign in to comment.