From 73a371ae49072127fe17becb82192874b86477f0 Mon Sep 17 00:00:00 2001 From: Frederick Pruneau Date: Wed, 7 Jan 2026 10:26:20 -0500 Subject: [PATCH] Modification in Dockerfile to remove the necessity to have a persistent folder on the docker host. Also added modification in docker-compose file to reflect the Dockerfile changes. --- Dockerfile | 34 +++++++++++++--------------------- docker-compose.yaml | 2 +- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff7e303..9ec98a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,20 @@ -# targo-frontend -FROM node:22 - -# Set working directory inside container +# Step 1 - Building the app +FROM node:22 AS build WORKDIR /app - -# Adding Quasar -RUN yarn global add @quasar/cli - +COPY package*.json ./ # Set environment variables ARG BACKEND_URL ENV VITE_TARGO_BACKEND_URL=$BACKEND_URL - -# Copy the code -COPY . . - # Install dependencies +RUN npm install -g @quasar/cli +COPY . . RUN npm install +RUN npm run build -# Linting and formating -RUN yarn -RUN yarn lint - -# Expose Quasar dev port -EXPOSE 9000 - -# Default command -CMD ["npm", "run", "dev"] +# Step 2 - Move Applicatin to Nginx +FROM nginx:alpine +COPY --from=build /app/dist/spa /usr/share/nginx/html +RUN mkdir /usr/share/nginx/html/src +COPY --from=build /app/src /usr/share/nginx/html/src +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 1d6df07..f09bd4c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -23,4 +23,4 @@ services: env_file: - stack.env ports: - - ${FRONTEND_PUBLIC_PORT}:9000 \ No newline at end of file + - ${FRONTEND_PUBLIC_PORT}:80 \ No newline at end of file