Working log in/route guard
This commit is contained in:
@@ -1,32 +1,36 @@
|
||||
|
||||
|
||||
# --- STAGE 1: Build the Vue application ---
|
||||
FROM node:20.11.1 AS builder
|
||||
|
||||
|
||||
# Set build-time environment variables for your API URLs
|
||||
ENV VITE_BASE_URL="https://apioil.edwineames.com"
|
||||
ENV VITE_MONEY_URL="https://apimoney.edwineames.com"
|
||||
ENV VITE_AUTO_URL="https://apiauto.edwineames.com"
|
||||
|
||||
ENV VITE_COMPANY_ID="1"
|
||||
ENV NODE_ENV=production
|
||||
ENV VITE_MONEY_URL="https://apimoney.edwineames.com"
|
||||
|
||||
WORKDIR /app
|
||||
COPY package*.json .
|
||||
RUN npm ci
|
||||
|
||||
COPY package.json ./
|
||||
|
||||
# --- THE FIX IS HERE ---
|
||||
# 1. Install ALL dependencies (including devDependencies like vue-tsc)
|
||||
RUN npm install
|
||||
|
||||
# 2. Copy the rest of your source code
|
||||
COPY . .
|
||||
|
||||
# 3. Now run the build, which will succeed because vue-tsc is installed
|
||||
RUN npm run build
|
||||
RUN npm prune --production
|
||||
|
||||
# --- STAGE 2: Serve the built files with Nginx ---
|
||||
FROM nginx:stable-alpine
|
||||
|
||||
|
||||
|
||||
FROM nginx:stable-alpine as production-stage
|
||||
ENV NODE_ENV=production
|
||||
# Copy the build application from the previous stage to the Nginx container
|
||||
# Copy the static files from the 'builder' stage
|
||||
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
|
||||
|
||||
# Copy your custom Nginx configuration
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Tell the world that port 80 is now listening
|
||||
EXPOSE 80
|
||||
# Start Nginx to serve the application
|
||||
|
||||
# Start Nginx when the container launches
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user