FROM gitea.pena/penadevops/container-images/golang:main as build
WORKDIR /app
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 as prod
COPY --from=build /app/amocrm .
COPY --from=build /app/token_refresher .
CMD ["/amocrm"]
