test: test build
This commit is contained in:
parent
18b0fefce8
commit
a1084ee5ed
12
Dockerfile
12
Dockerfile
|
@ -1,4 +1,7 @@
|
|||
|
||||
FROM nginx:alpine as production
|
||||
EXPOSE 80
|
||||
|
||||
FROM node:20-slim as base
|
||||
ENV PROJECT_DIR=/huaxin-front \
|
||||
PNPM_HOME="/pnpm" \
|
||||
|
@ -25,10 +28,7 @@ RUN pnpm run build
|
|||
FROM base AS result
|
||||
COPY --from=prod-deps $PROJECT_DIR/node_modules $PROJECT_DIR/node_modules
|
||||
COPY --from=builder $PROJECT_DIR/dist $PROJECT_DIR/dist
|
||||
|
||||
COPY --from=builder $PROJECT_DIR/dist/ /usr/share/nginx/html
|
||||
COPY --from=builder $PROJECT_DIR/nginx.conf /etc/nginx/nginx.conf
|
||||
# 构建nginx,并且在result之后拷贝dist到nginx中,其中包含了自定义nginx.conf
|
||||
FROM nginx:alpine as production
|
||||
ENV PROJECT_DIR=/huaxin-front
|
||||
COPY --from=result $PROJECT_DIR/dist/ /usr/share/nginx/html
|
||||
COPY --from=result $PROJECT_DIR/nginx.conf /etc/nginx/nginx.conf
|
||||
EXPOSE 80
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: production
|
||||
target: result
|
||||
container_name: huaxin-base-frontend
|
||||
ports:
|
||||
- '80:80'
|
||||
|
|
Loading…
Reference in New Issue