Update Dockerfile-web-ui-dev to use Node 18.16.0 and Alpine 3.17.2

This commit is contained in:
2025-02-02 18:36:23 +07:00
parent 2ffd73a012
commit 6d770469de
2 changed files with 56 additions and 33 deletions

View File

@@ -1,14 +1,38 @@
FROM node:18-alpine3.17 as build
# Use an official Node.js image as the base
FROM node:18-alpine
# Set the working directory in the container
WORKDIR /app
COPY . /app
RUN npm install
# 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 ./
# Install dependencies with the --legacy-peer-deps flag to bypass peer dependency conflicts
RUN npm install --legacy-peer-deps
# Copy the rest of the app's source code to the container
COPY . .
# Build the app
RUN npm run build
FROM ubuntu
RUN apt-get update
RUN apt-get install nginx -y
COPY --from=build /app/dist /var/www/html/
# 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
CMD ["nginx","-g","daemon off;"]
# Start the NGINX web server
CMD ["nginx", "-g", "daemon off;"]