Skip to content

Commit

Permalink
feature: docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
abdahmed22 committed Jul 7, 2024
1 parent 9b31ef4 commit 30361bd
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM golang:1.22.5-alpine3.20 AS base

WORKDIR /app

COPY go.mod go.sum ./

COPY pkg/httpserver ./pkg/httpserver/
COPY cmd/httpserver/main.go ./cmd/httpserver/

COPY pkg/ginserver ./pkg/ginserver/
COPY cmd/ginserver/main.go ./cmd/ginserver/

ENV PORT=8080

RUN go mod download

FROM base AS build-http
RUN go build -o /bin/httpserver ./cmd/httpserver


FROM base AS build-gin
RUN go build -o /bin/ginserver ./cmd/ginserver


FROM scratch AS http
COPY --from=build-http /bin/httpserver /cmd/

ENTRYPOINT [ "/bin/httpserver" ]

EXPOSE 8080

CMD ["./main"]

FROM scratch AS gin
COPY --from=build-gin /bin/ginserver /cmd/

ENTRYPOINT [ "/bin/ginserver" ]

EXPOSE 8080

CMD ["./main"]

0 comments on commit 30361bd

Please sign in to comment.