FROM dockerhub.timeweb.cloud/golang:alpine as build
WORKDIR /app
RUN apk add git
COPY . .
ARG GITLAB_TOKEN
ENV GOPRIVATE=penahub.gitlab.yandexcloud.net/backend/penahub_common
RUN git config --global url."https://buildToken:glpat-axA8ttckx3aPf_xd2Dym@penahub.gitlab.yandexcloud.net/".insteadOf "https://penahub.gitlab.yandexcloud.net/"
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o amocrm ./cmd/main.go

FROM penahub.gitlab.yandexcloud.net:5050/devops/dockerhub-backup/alpine as prod
COPY --from=build /app/amocrm .
EXPOSE 1488
ENV IS_PROD_LOG=false
ENV IS_PROD=false
CMD ["/amocrm"]
