How to include my local bashrc on my development environment

Hi @ramiro ,
I am facing one issue when I create another image and use that in okteto.yaml image section of dev.
I installed angularcli through nvm and npm that Dockerfile. But ng works in bash shell. Hence I added below highlighted line

RUN . $NVM_DIR/nvm.sh
&& . $NVM_DIR/bash_completion
RUN nvm install $NODE_VERSION
&& nvm alias default $NODE_VERSION
&& nvm use default
&& npm install -g @angular/cli

ENTRYPOINT [“.”,“~/.bashrc”]

when I specify below line ng not working when I run okteto up.

command: cd /usr/src/app && mvn -f myapp-war/pom.xml spring-boot:run

So I had to add . ~/.bashrc in command to make it work as below. Any idea?

command: . ~/.bashrc && cd /usr/src/app && mvn -f myapp-war/pom.xml spring-boot:run

Thanks in advance

Hi @prasanta , I believe that is not working because you are not including your bashrc file on the container. I can think of a couple of options:

Include the bashrc file on your container image

FROM: XXXX
WORKDIR /usr/src/app
RUN . $NVM_DIR/nvm.sh
   && . $NVM_DIR/bash_completion
RUN nvm install $NODE_VERSION
  && nvm alias default $NODE_VERSION 
  && nvm use default
  && npm install -g @angular/cli
ADD bashrc /root/.bashrc
CMD "mvn -f myapp-war/pom.xml spring-boot:run"

Define .bashrc as a secret on the okteto.yaml so it’s mounted when you run ‘okteto up’

dev:
  service_name:
     command:  "mvn -f myapp-war/pom.xml spring-boot:run"
     workdir: /usr/src/app
     sync:
     - .:/usr/src/app
     secret:
     - ~/.bashrc:/root/.bashrc

Hi @ramiro ,
Here .bashrc is created inside image when nvm and rpm install executes. I needed that .bashrc to be sourced when I run mvn -f myapp-war/pom.xml spring-boot:run inside okteto development container.
As I dont have that .bashrc in advance, mounting will not work. .bashrc is already available inside dev container, not sure how to source it other than running . ~/.bashrc in command section of okteto.yaml

:wave: @prasanta,

To run multiple commands in a single command such as sourcing the /.bashrc and start spring-boot, you could do the following in your okteto.yml:

command: bash -c ". ./.bashrc && cd /usr/src/app && mvn -f myapp-war/pom.xml spring-boot:run

I hope it helps, let us know!