build(docker): install node by copying files from official image

This commit is contained in:
Andrei Jiroh Halili 2024-06-07 18:15:19 +08:00 committed by GitHub
parent 03c329238f
commit e991b4b677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,12 +1,18 @@
# syntax=docker/dockerfile:1
FROM python:3.12-alpine AS buildkit
# Instead of using Alpine base image and then installing Python from pkgs.al.o,
# we'll go with the official images instead.
FROM python:3.12-alpine AS buildkit
# Since hadolint isn't in the package repos for Alpine yet, we'll copying from the offical
# Docker image instead.
COPY --from=ghcr.io/hadolint/hadolint:latest-alpine /bin/hadolint /usr/bin/hadolint
# Copy build artifacts from official node image into here
ENV YARN_VERSION 1.22.22
COPY --from=node:20-alpine /opt/yarn-v$YARN_VERSION/bin/ /usr/local/bin/
COPY --from=node:20-alpine /usr/local/bin/node /usr/local/bin/node
COPY --from=node:20-alpine /usr/lib/node_modules/ /usr/lib/node_modules/
ENV PACKAGES=/usr/local/lib/python3.11/site-packages PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin PYTHONDONTWRITEBYTECODE=1
LABEL org.opencontainers.image.description="GitLab CI image for custom mkdocs-material Docker image, alongside tools @ajhalili2006 use."
@ -26,9 +32,6 @@ RUN apk add --no-cache \
gcc \
libffi-dev \
musl-dev \
nodejs \
npm \
yarn \
git \
git-email \
git-lfs \