diff --git a/docker/api.Containerfile b/docker/api.Containerfile index 63c96d7a2da..bb7e416bcdb 100644 --- a/docker/api.Containerfile +++ b/docker/api.Containerfile @@ -32,11 +32,18 @@ RUN groupmod -n talawa vscode \ && touch /commandhistory/.bash_history \ && chown -R talawa /commandhistory \ && echo "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" >> /home/talawa/.bashrc +# Create a global profile script that both login and non-interactive shells load +RUN echo '#!/bin/sh' > /etc/profile.d/fnm.sh \ + && echo 'export PATH="/home/talawa/.local/share/fnm:$PATH"' >> /etc/profile.d/fnm.sh \ + && echo 'eval "$(fnm env --corepack-enabled --resolve-engines --use-on-cd --version-file-strategy=recursive)"' >> /etc/profile.d/fnm.sh \ + && chmod +x /etc/profile.d/fnm.sh +# Ensure non-interactive bash sessions load the script +ENV BASH_ENV=/etc/profile.d/fnm.sh +# Also, have the talawa login shell source it explicitly by appending to its .bashrc +RUN echo "source /etc/profile.d/fnm.sh" >> /home/talawa/.bashrc USER talawa # Installs fnm. -RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell \ -# Appends the fnm configuration to `/home/talawa/.bashrc` file. -&& echo eval \"\$\(fnm env --corepack-enabled --resolve-engines --use-on-cd --version-file-strategy=recursive\)\" >> /home/talawa/.bashrc +RUN curl -fsSL --proto '=https' --tlsv1.2 https://fnm.vercel.app/install | bash -s -- --skip-shell ENV PATH=/home/talawa/.local/share/fnm:${PATH} WORKDIR /home/talawa/api diff --git a/docs/docs/docs/getting-started/installation.md b/docs/docs/docs/getting-started/installation.md index 13047661d8d..fb5a5f6b9e2 100644 --- a/docs/docs/docs/getting-started/installation.md +++ b/docs/docs/docs/getting-started/installation.md @@ -392,13 +392,9 @@ We have created sample data to make it easier for end users to get an understand This applies to users running Talawa API in dev containers. 1. Once the server is running, open a new terminal session. -2. Open a bash session inside the running container: +2. Run the following command to import sample data into the database: ```bash - docker exec -it talawa-api-1 /bin/bash - ``` -3. Inside the container, run the following command to import sample data into the database: - ```bash - pnpm run import:sample-data + docker exec talawa-api-1 /bin/bash -c 'pnpm run add:sample_data && exit' ``` 4. Then exit ```bash