From e3bec4d1d0f6d34a73fefa7d37f0143648e6cec7 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Wed, 23 Jul 2025 17:47:45 +0530 Subject: [PATCH] Writing backend uri to .env after copying contents and cleaning up after build. --- Frontend/Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Frontend/Dockerfile b/Frontend/Dockerfile index 24a53af..cf3754f 100644 --- a/Frontend/Dockerfile +++ b/Frontend/Dockerfile @@ -21,13 +21,20 @@ RUN useradd -s /bin/bash nonroot RUN mkdir -p /app RUN chown -R nonroot:nonroot /app WORKDIR /app + +# Copying contents COPY . . -RUN echo $BACKEND_URI > /app/.env + +# Writing backend uri in .env +RUN echo "VITE_API_URL = $BACKEND_URI" > /app/.env # Building frontend RUN npm install RUN npm run build +# Clean-up +RUN rm -rf eslint.config.js index.html node_modules/ package-lock.json package.json postcss.config.js public/ src/ tailwind.config.js vite.config.js .dockerignore .gitignore .vite/ + # Install server RUN npm install -g serve