Q:

docker-compose: error while trying to install MDBoostrap Pro with oauth authentication

I'm trying to deploy and application developed with MDBootstrap Pro which is installed via npm + oauth2 authentication.
Basically, into dir project, in order to install it you have to run the following command:
npm install git+https://oauth2:YOUR_TOKEN@git.mdbootstrap.com/mdb/angular/ng-uikit-pro-standard.git --save

It works fine, until you have to put your project into a container.
This is my Dockerfile:
FROM node:13.10-alpine AS builder
COPY ./ ./portal/
WORKDIR /portal
RUN npm i
RUN $(npm bin)/ng build --prod

FROM httpd:2.4
COPY --from=builder /portal/dist/InternationalItaly/ /usr/local/apache2/htdocs/

When the build reaches the line RUN npm i, it crashes for this reason:
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://oauth2:TOUR_TOKEN@git.mdbootstrap.com/mdb/angular/ng-uikit-pro-standard.git

I tried to install it before the npm i, but the problem seems to be not solved. I don't want to import it as a huge asset (basically, cloning the repo into the assets of my project), i would like to implement it as a npm dependency.

A:

I think you have to install git
Try this:
FROM node:13.10-alpine AS builder
RUN apk add --no-cache git
COPY ./ ./portal/
WORKDIR /portal
RUN npm i
RUN $(npm bin)/ng build --prod

FROM httpd:2.4
COPY --from=builder /portal/dist/InternationalItaly/ /usr/local/apache2/htdocs/

Personally I prefer the git+ssh://...
An Example:
ARG KNOWN_HOSTS
ARG ID_RSA

RUN apk add --no-cache git openssh
RUN mkdir ~/.ssh && echo $KNOWN_HOSTS >> ~/.ssh/known_hosts && echo -en $ID_RSA >> ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
RUN mv ssh_config ~/.ssh/ssh_config

Hope this helps

