From acab66a56c68cd84afad3c6c21378fba5e478be1 Mon Sep 17 00:00:00 2001 From: JaiPannu-IITI Date: Mon, 24 Feb 2025 21:48:41 +0530 Subject: [PATCH 1/2] docker shells configured --- docker/api.Containerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docker/api.Containerfile b/docker/api.Containerfile index 63c96d7a2da..37a81fb5d1c 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 https://fnm.vercel.app/install | bash -s -- --skip-shell ENV PATH=/home/talawa/.local/share/fnm:${PATH} WORKDIR /home/talawa/api From 5d30fdfc475975333fd37b579e2dbfc294ecbe5a Mon Sep 17 00:00:00 2001 From: JaiPannu-IITI Date: Mon, 24 Feb 2025 22:22:07 +0530 Subject: [PATCH 2/2] enhanced security and docs --- docker/api.Containerfile | 2 +- docs/docs/docs/getting-started/installation.md | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docker/api.Containerfile b/docker/api.Containerfile index 37a81fb5d1c..bb7e416bcdb 100644 --- a/docker/api.Containerfile +++ b/docker/api.Containerfile @@ -43,7 +43,7 @@ ENV BASH_ENV=/etc/profile.d/fnm.sh 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 +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