46 lines
1.3 KiB
Docker
46 lines
1.3 KiB
Docker
# Typescript Build
|
|
FROM registry.odit.services/hub/library/node:19.0.1-alpine3.16 AS build
|
|
ARG NPM_REGISTRY_URL=https://registry.npmjs.org
|
|
WORKDIR /app
|
|
|
|
COPY package.json ./
|
|
RUN npm config set registry $NPM_REGISTRY_URL && npm i -g pnpm@8 && pnpm i
|
|
|
|
COPY tsconfig.json ./
|
|
COPY src ./src
|
|
RUN pnpm build \
|
|
&& rm -rf /app/node_modules \
|
|
&& pnpm i --production --prefer-offline
|
|
|
|
# final image
|
|
FROM registry.odit.services/hub/library/alpine:3.16
|
|
WORKDIR /app
|
|
RUN apk add --no-cache \
|
|
chromium \
|
|
nss \
|
|
freetype \
|
|
freetype-dev \
|
|
harfbuzz \
|
|
ca-certificates \
|
|
ttf-freefont \
|
|
nodejs \
|
|
font-noto-emoji \
|
|
&& apk add wqy-zenhei --update-cache --repository https://nl.alpinelinux.org/alpine/edge/testing
|
|
|
|
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
|
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
|
|
RUN addgroup -S pptruser && adduser -S -g pptruser pptruser \
|
|
&& mkdir -p /home/pptruser/Downloads /app \
|
|
&& chown -R pptruser:pptruser /home/pptruser \
|
|
&& chown -R pptruser:pptruser /app
|
|
|
|
# Run everything after as non-privileged user.
|
|
USER pptruser
|
|
|
|
COPY --from=build /app/package.json /app/
|
|
COPY --from=build /app/node_modules /app/node_modules
|
|
COPY --from=build /app/dist app
|
|
COPY ./src/static app/static
|
|
ENTRYPOINT ["node", "app/app.js"] |