refactor(core): Rebuild docker infrastructure (#8451)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-01-26 13:18:49 +01:00
committed by GitHub
parent fc5c562785
commit 1db35c18e9
11 changed files with 75 additions and 100 deletions

View File

@@ -1,20 +1,38 @@
ARG NODE_VERSION=18
FROM node:${NODE_VERSION}-alpine
WORKDIR /home/node
COPY .npmrc /usr/local/etc/npmrc
# 1. Use a builder step to download various dependencies
FROM node:${NODE_VERSION}-alpine as builder
RUN \
apk add --update git openssh graphicsmagick tini tzdata ca-certificates libc6-compat && \
npm install -g npm@9.5.1 full-icu && \
rm -rf /var/cache/apk/* /root/.npm /tmp/* && \
# Install fonts
# Install fonts
RUN \
apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \
update-ms-fonts && \
fc-cache -f && \
apk del fonts && \
find /usr/share/fonts/truetype/msttcorefonts/ -type l -exec unlink {} \; && \
rm -rf /var/cache/apk/* /tmp/*
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
# 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
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
EXPOSE 5678/tcp