FROM golang:1.22.5-alpine as builder

# installing git
RUN apk update && apk upgrade && \
    apk add --no-cache bash git openssh

# setting working directory
WORKDIR /go/src/app


COPY / /go/src/app/
# installing dependencies
RUN go mod download

RUN go build -o myapp

FROM alpine:3.10

RUN apk update && apk upgrade && \
    apk add --no-cache openssh curl ca-certificates

WORKDIR /go/src/app
COPY --from=builder /go/src/app/myapp /go/src/app/myapp

EXPOSE 5000

CMD ["./myapp"]