56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
ARG NODE_VERSION=18.17.0
|
|
ARG ALPINE_VERSION=3.19.0
|
|
|
|
FROM node:${NODE_VERSION}-alpine AS node
|
|
|
|
FROM alpine:${ALPINE_VERSION} AS builder
|
|
|
|
COPY --from=node /usr/lib /usr/lib
|
|
COPY --from=node /usr/local/lib /usr/local/lib
|
|
COPY --from=node /usr/local/include /usr/local/include
|
|
COPY --from=node /usr/local/bin /usr/local/bin
|
|
|
|
RUN node -v
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /app
|
|
|
|
# Copy the package.json and package-lock.json first to leverage Docker's cache
|
|
COPY ./src/Managing.WebApp/package*.json ./
|
|
#RUN npm config set registry http://registry.cnpmjs.org
|
|
# Install dependencies
|
|
#RUN npm ci --production --loglevel=verbose
|
|
#RUN npm i --omit=dev --loglevel=verbose
|
|
RUN apk update && apk add --no-cache git
|
|
# Remove Yarn and Yarnpkg binaries if they exist
|
|
RUN rm -f /usr/local/bin/yarn /usr/local/bin/yarnpkg
|
|
|
|
# Install Yarn globally
|
|
RUN npm install -g yarn
|
|
|
|
|
|
#RUN npm i --max-old-space-size=12000 --loglevel=verbose
|
|
RUN yarn add eslint-plugin-jsdoc@36.0.8 --dev
|
|
RUN yarn install --ignore-engines --verbose
|
|
RUN yarn cache clean
|
|
# Copy the application code
|
|
COPY . .
|
|
|
|
# Build the Vite application
|
|
#RUN npm run build
|
|
RUN node --max-old-space-size=4096 ./node_modules/.bin/vite build
|
|
# Stage 2: Create the runtime image
|
|
FROM 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 you need one)
|
|
# COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start the Nginx server
|
|
CMD ["nginx", "-g", "daemon off;"]
|