From 207ed14b58800c4fda5f2b3cf27511f5c4a36331 Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Thu, 22 Aug 2024 17:28:41 +0200 Subject: [PATCH] Multistage Builder for Compiled Modules --- Dockerfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 45bb8d6..6aed230 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -# PaStash Docker Example -FROM node:20-slim - -RUN mkdir -p /usr/src/app -WORKDIR /usr/src/app - -COPY package.json /usr/src/app/ +# PaStash Docker Builder +FROM node:20-slim as builder +RUN apt update && apt install -y python3 make gcc g++ +RUN mkdir -p /app +WORKDIR /app +COPY package.json /app/ RUN npm install +COPY . /app -COPY . /usr/src/app - +# PaStash Docker Container +FROM node:20-slim RUN mkdir -p /config - +COPY --from=builder /app /app +WORKDIR /app EXPOSE 8080 CMD [ "bin/pastash", "--config_dir", "/config" ] -