2024-05-24 03:32:50 -07:00
|
|
|
ARG NODE_VERSION=20
|
2022-08-31 06:25:52 -07:00
|
|
|
|
2024-01-26 04:18:49 -08:00
|
|
|
# 1. Use a builder step to download various dependencies
|
|
|
|
FROM node:${NODE_VERSION}-alpine as builder
|
2022-08-31 06:25:52 -07:00
|
|
|
|
2024-01-26 04:18:49 -08:00
|
|
|
# Install fonts
|
|
|
|
RUN \
|
2022-08-31 06:25:52 -07:00
|
|
|
apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \
|
|
|
|
update-ms-fonts && \
|
|
|
|
fc-cache -f && \
|
|
|
|
apk del fonts && \
|
2024-01-26 04:18:49 -08:00
|
|
|
find /usr/share/fonts/truetype/msttcorefonts/ -type l -exec unlink {} \;
|
|
|
|
|
|
|
|
# Install git and other OS dependencies
|
|
|
|
RUN apk add --update git openssh graphicsmagick tini tzdata ca-certificates libc6-compat jq
|
|
|
|
|
|
|
|
# Update npm and install full-uci
|
|
|
|
COPY .npmrc /usr/local/etc/npmrc
|
|
|
|
RUN npm install -g npm@9.9.2 full-icu@1.5.0
|
2022-08-31 06:25:52 -07:00
|
|
|
|
2024-01-26 04:18:49 -08:00
|
|
|
# Activate corepack, and install pnpm
|
|
|
|
WORKDIR /tmp
|
|
|
|
COPY package.json ./
|
|
|
|
RUN corepack enable && corepack prepare --activate
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
RUN rm -rf /lib/apk/db /var/cache/apk/ /tmp/* /root/.npm /root/.cache/node /opt/yarn*
|
|
|
|
|
|
|
|
# 2. Start with a new clean image and copy over the added files into a single layer
|
|
|
|
FROM node:${NODE_VERSION}-alpine
|
|
|
|
COPY --from=builder / /
|
|
|
|
|
|
|
|
# Delete this folder to make the base image backward compatible to be able to build older version images
|
|
|
|
RUN rm -rf /tmp/v8-compile-cache*
|
|
|
|
|
|
|
|
WORKDIR /home/node
|
2022-08-31 06:25:52 -07:00
|
|
|
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
|
|
|
|
EXPOSE 5678/tcp
|