From 2957930be4813b560f0f23171a6e9e9c7574e9c2 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Wed, 23 Jul 2025 17:24:13 +0530 Subject: [PATCH] No longer generating refresh token while building the container. Also switching to nonroot user before copying files and installing dependencies. --- Backend/Dockerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Backend/Dockerfile b/Backend/Dockerfile index 83ab99c..938f947 100644 --- a/Backend/Dockerfile +++ b/Backend/Dockerfile @@ -14,18 +14,22 @@ RUN apt update && apt upgrade -y && \ RUN useradd -s /bin/bash nonroot # Create working directory -RUN mkdir -p /app -RUN chown -R nonroot:nonroot /app +RUN mkdir -p /app /home/nonroot +RUN chown -R nonroot:nonroot /app /home/nonroot WORKDIR /app -COPY . . - -# Generate a random hex token and write it to .env -RUN echo "REFRESH_TOKEN_SECRET = $(openssl rand -hex 32)" >> /app/.env -RUN npm install # Switch user USER nonroot +# Copy contents +COPY . . + +# Generate a random hex token and write it to .env +#RUN echo "REFRESH_TOKEN_SECRET = $(openssl rand -hex 32)" >> /app/.env + +# Install dependencies +RUN npm install + # Expose backend port EXPOSE 8000