Toán tin vuotlen.com

Cách Dockerfile dự án frontend

Server:

//

## build stage ##

FROM node:18.18-alpine as build

WORKDIR /app

COPY ..

RUN npm install

RUN npm run build

## run stage ##

FROM nginx:alpine

COPY –from=build /app/dist /usr/share/nginx/html

EXPOSE 80

CMD [“nginx”, “-g”, “deamon off;”]

//

docker build –t todolist:v1 .

docker run –name todolist-v1 –dp 6868:80 todolist:v1

chrome gõ: ip:6868, web chạy