New webui dockerfile
This commit is contained in:
@@ -1,66 +1,14 @@
|
|||||||
ARG NODE_VERSION=18.20.2
|
FROM node:18-alpine3.17 as build
|
||||||
ARG ALPINE_VERSION=3.17.2
|
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS node
|
|
||||||
|
|
||||||
FROM alpine:${ALPINE_VERSION}
|
|
||||||
|
|
||||||
# Set the working directory in the container
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
COPY --from=node /usr/lib /usr/lib
|
RUN npm install
|
||||||
COPY --from=node /usr/local/lib /usr/local/lib
|
RUN npm run build
|
||||||
COPY --from=node /usr/local/include /usr/local/include
|
|
||||||
COPY --from=node /usr/local/bin /usr/local/bin
|
|
||||||
|
|
||||||
RUN node -v
|
FROM ubuntu
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install nginx -y
|
||||||
|
COPY --from=build /app/dist /var/www/html/
|
||||||
# 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 --force
|
|
||||||
|
|
||||||
RUN yarn -v
|
|
||||||
|
|
||||||
#RUN npm i --max-old-space-size=12000 --loglevel=verbose
|
|
||||||
# RUN yarn add eslint-plugin-jsdoc@37.9.7 --dev --ignore-engines
|
|
||||||
|
|
||||||
# Explicitly install Tailwind CSS and plugins if needed
|
|
||||||
RUN yarn add -D tailwindcss postcss autoprefixer @tailwindcss/typography
|
|
||||||
RUN yarn install --verbose
|
|
||||||
|
|
||||||
# Copy the application code
|
|
||||||
COPY src/Managing.WebApp/ /app/
|
|
||||||
RUN ls -alh
|
|
||||||
RUN ls -alh src/
|
|
||||||
# Build the Vite application
|
|
||||||
|
|
||||||
|
|
||||||
#RUN npm run build
|
|
||||||
RUN node --max-old-space-size=8192 ./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
|
EXPOSE 80
|
||||||
|
CMD ["nginx","-g","daemon off;"]
|
||||||
# Start the Nginx server
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
|
||||||
Reference in New Issue
Block a user