hrms-report-template/Dockerfile
waruneeauy a48b15eae3
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m48s
fix run error
2025-09-16 17:10:48 +07:00

47 lines
2.5 KiB
Docker

# docker build -t docker.frappet.com/demo/report-server .
# docker push docker.frappet.com/demo/report-server
# docker run --name rserver -p 80:3000 docker.frappet.com/demo/report-server
FROM node:22-bookworm-slim
ENV TZ=Asia/Bangkok
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir -p /usr/share/fonts/truetype/th
COPY ./ThaiFonts/*.ttf /usr/share/fonts/truetype/th/
RUN apt-get update && apt-get -y install wget fonts-noto fonts-noto-cjk libreoffice --no-install-recommends
## old work library chrominum 2.29GB
# RUN apt-get -y install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 \
# libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 \
# libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \
# libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation \
# libappindicator1 libnss3 lsb-release xdg-utils chromium --no-install-recommends
# new test with chrominum 1.77GB ตรวจขนาดหน้า blognone ผิดติดเป็นสองหน้า
# RUN apt-get -y install --no-install-recommends libx11-xcb1 libxcomposite1 libasound2 libatk1.0-0 libatk-bridge2.0-0 \
# libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 \
# libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \
# libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6
## new test with chrome 1.81GB
RUN apt-get install -y --no-install-recommends ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 \
libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 \
libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
RUN npx puppeteer install chrome --install-deps
RUN fc-cache -f && rm -rf /var/cache/* && apt -y autoremove && rm -rf /var/lib/apt/lists/* && apt-get clean
RUN mkdir /app
WORKDIR /app
COPY package.json .
COPY tsconfig.json .
COPY libs libs
COPY app.ts .
COPY yaqrcode.d.ts .
COPY templates templates
ENV NODE_ENV=development
RUN npm install
RUN npm run build
ENV NODE_ENV=production
RUN npm prune --production
EXPOSE 80
CMD ["node","dist/app.js"]