FROM gitea.pena/penadevops/container-images/golang:main as build
WORKDIR /app
RUN apk add git
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o amocrm ./cmd/main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o token_refresher ./cmd/tokens/main.go

FROM gitea.pena/penadevops/container-images/alpine:main
COPY --from=build /app/amocrm .
COPY --from=build /app/token_refresher .
EXPOSE 1488
ENV IS_PROD_LOG=false
ENV IS_PROD=false
CMD ["/amocrm"]
