new pipeline and build improvements
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -1,19 +1,18 @@
|
||||
FROM node:alpine AS build
|
||||
FROM node:22-alpine AS build
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY . /src
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Install terser to minify JS files
|
||||
RUN npm install -g terser
|
||||
RUN if [ -d "js" ]; then find js -type f -name "*.js" -exec sh -c 'for f; do terser "$f" -c -m -o "$f"; done' sh {} +; fi
|
||||
COPY . .
|
||||
RUN OUTPUT_DIR=/dist npm run build:production
|
||||
|
||||
FROM nginx:alpine-slim AS final
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY . /usr/share/nginx/html
|
||||
COPY --from=build /src/js /usr/share/nginx/html/js
|
||||
COPY --from=build /dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
Reference in New Issue
Block a user