<commit_before>FROM node:lts-alpine as builder

RUN apk add bash curl git && apk update

ARG KUSTOMIZE_VERSION="v3.8.1"
RUN curl -fsSL -o /kustomize-${KUSTOMIZE_VERSION}-linux-amd64.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
    tar -zxvf /kustomize-${KUSTOMIZE_VERSION}-linux-amd64.tar.gz && \
    mv kustomize /usr/local/bin/kustomize

RUN curl -fsSL -o /usr/local/bin/kpt https://storage.googleapis.com/kpt-dev/latest/linux_amd64/kpt && \
    chmod +x /usr/local/bin/kpt

RUN mkdir -p /home/node/app && \
    chown -R node:node /home/node/app

USER node

WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
# Make rw package for sops package.
# TODO: Please remove next line when https://github.com/GoogleContainerTools/kpt/issues/1026 is done
COPY --chown=node:node @types @types
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
COPY --chown=node:node src src
RUN npm run build && \
    npm prune --production && \
    rm -r src tsconfig.json

#############################################

FROM node:lts-alpine

RUN apk add git

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md<commit_msg>Added docker-cli package to kustomize_build fn (#106)<commit_after>FROM node:lts-alpine as builder

RUN apk add bash curl git && apk update

ARG KUSTOMIZE_VERSION="v3.8.1"
RUN curl -fsSL -o /kustomize-${KUSTOMIZE_VERSION}-linux-amd64.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
    tar -zxvf /kustomize-${KUSTOMIZE_VERSION}-linux-amd64.tar.gz && \
    mv kustomize /usr/local/bin/kustomize

RUN curl -fsSL -o /usr/local/bin/kpt https://storage.googleapis.com/kpt-dev/latest/linux_amd64/kpt && \
    chmod +x /usr/local/bin/kpt

RUN mkdir -p /home/node/app && \
    chown -R node:node /home/node/app

USER node

WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
# Make rw package for sops package.
# TODO: Please remove next line when https://github.com/GoogleContainerTools/kpt/issues/1026 is done
COPY --chown=node:node @types @types
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
COPY --chown=node:node src src
RUN npm run build && \
    npm prune --production && \
    rm -r src tsconfig.json

#############################################

FROM node:lts-alpine

RUN apk add git docker-cli

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
{'fraction_non_alphanumeric': 0.15895227843559384, 'fraction_numerical': 0.012558306422676713, 'mean_word_length': 3.823529411764706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '968675', 'n_tokens_mistral': 1051, 'n_tokens_neox': 986, 'n_words': 232}