Files
managing-apps/src/Managing.WebApp/Dockerfile-web-ui-dev
2024-05-10 21:13:59 +05:00

46 lines
1.4 KiB
Plaintext

# Set base image for the builder stage
FROM --platform=linux/arm64/v8 node:18.17.0
# Set the working directory in the container
WORKDIR /app
# Install xsel if needed (uncomment if required in your environment)
# RUN apt-get update && apt-get install -y xsel
# Copy the package.json and package-lock.json first to leverage Docker's cache
COPY ./src/Managing.WebApp/package*.json ./
# Optionally, add a specific package ignoring engine check
RUN yarn add whatwg-fetch@3.6.2 --ignore-engines
# Install all project dependencies with Yarn
RUN yarn install
# Clear Yarn cache to ensure no corrupted data interferes with installation
RUN yarn cache clean
# Copy the rest of your application code
COPY . .
# Set necessary environment variables (if they are not secrets)
ENV NODE_ENV=development
ENV VITE_API_URL_LOCAL=https://localhost:5001
ENV VITE_API_URL_SERVER=https://localhost
# Build the application with increased memory options for Node
RUN node --max-old-space-size=4096 ./node_modules/.bin/vite build
# Stage 2: Create the runtime image
FROM --platform=linux/arm64/v8 nginx:alpine
# Copy the built Vite application from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy a custom Nginx configuration file (if needed)
# COPY nginx.conf /etc/nginx/nginx.conf
# Expose port 80 for the Nginx server
EXPOSE 80
# Command to start the Nginx server
CMD ["nginx", "-g", "daemon off;"]