Files
managing-apps/src/Managing.WebApp/Dockerfile-web-ui-dev

42 lines
1.2 KiB
Plaintext

# Use an official Node.js image as the base
FROM node:18-alpine
# Set the working directory in the container
WORKDIR /app
# Set environment variable to skip Chromium download
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
# Install git and Python
RUN apk update && apk add --no-cache git python3 make g++
# Create a symlink for python3 as python
RUN ln -sf /usr/bin/python3 /usr/bin/python
# Copy package.json and package-lock.json to the container
# COPY package*.json ./
COPY /src/Managing.WebApp/package.json ./
# Install dependencies with the --legacy-peer-deps flag to bypass peer dependency conflicts
RUN npm install --legacy-peer-deps
RUN npm install -g tailwindcss postcss autoprefixer @tailwindcss/typography
# Copy the rest of the app's source code to the container
# COPY . .
COPY src/Managing.WebApp/ /app/
RUN node --max-old-space-size=8192 ./node_modules/.bin/vite build
# Build the app
RUN npm run build
# Use NGINX as the web server
FROM nginx:alpine
# Copy the built app to the NGINX web server directory
COPY --from=0 /app/build /usr/share/nginx/html
# Expose port 80 for the NGINX web server
EXPOSE 80
# Start the NGINX web server
CMD ["nginx", "-g", "daemon off;"]