diff --git a/Dockerfile.prod b/Dockerfile.prod new file mode 100644 index 0000000..d15ca84 --- /dev/null +++ b/Dockerfile.prod @@ -0,0 +1,29 @@ + + +FROM node:20.11.1 AS builder + +ENV VITE_BASE_URL="http://localhost:9510" +ENV VITE_PRINT_URL="http://localhost:9512" +ENV VITE_MONEY_URL="http://localhost:9513" +ENV VITE_AUTO_URL="http://localhost:9514" +ENV VITE_COMPANY_ID = 1 +ENV NODE_ENV=production + +WORKDIR /app +COPY package*.json . +RUN npm ci +COPY . . +RUN npm run build +RUN npm prune --production + + +FROM nginx:stable-alpine as production-stage +ENV NODE_ENV=production +# Copy the build application from the previous stage to the Nginx container +COPY --from=builder /app/dist /usr/share/nginx/html +# Copy the nginx configuration file +COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf +# Expose the port 80 +EXPOSE 80 +# Start Nginx to serve the application +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/index.html b/index.html index 3c8c78f..381a379 100755 --- a/index.html +++ b/index.html @@ -9,11 +9,7 @@ - - - - - + diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..5299bb9 --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,9 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html index.htm; +location / { + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file