1- # Use an official Ubuntu as a base image
2- FROM ubuntu:20.04
1+ # ##
2+ # STAGE: BASE
3+ # ##
4+ FROM node:22 AS base
35
46# Set non-interactive mode to avoid prompts during package installation
57ARG DEBIAN_FRONTEND=noninteractive
68
9+ # Setup pnpm
10+ ENV PNPM_HOME="/pnpm"
11+ ENV PATH="$PNPM_HOME:$PATH"
12+ RUN corepack enable
13+
714# Use bash for the shell
815SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
916
1017# Update and install useful CLI utilities
11- RUN apt-get update && apt-get install -y \
12- curl \
18+ RUN apt-get update && apt-get install -y ca-certificates
19+ RUN apt-get update && apt-get install -y curl \
1320 git \
1421 htop \
1522 vim \
@@ -18,42 +25,35 @@ RUN apt-get update && apt-get install -y \
1825 build-essential \
1926 nmap \
2027 sudo \
21- ca-certificates \
2228 lsb-release \
2329 nodejs \
24- npm \
2530 python3 \
2631 python3-pip \
32+ python3-matplotlib \
33+ python3-numpy \
34+ python3-pandas \
2735 && apt-get clean
2836
29- RUN pip3 install matplotlib numpy pandas
30-
31- # Install Node.js and Corepack
32- RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
33- && apt-get install -y nodejs \
34- && corepack enable
35-
36- # ENV NODE_VERSION 22.14.0
37-
38- # Download and install nvm
39- # RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | PROFILE="${BASH_ENV}" bash
40- # RUN echo node > .nvmrc
41- # RUN nvm install $NODE_VERSION
42- # RUN nvm use $NODE_VERSION
43-
44- # Set working directory
37+ # ##
38+ # STAGE: PRUNE - Generate a partial monorepo for the sandbox-container app. The output will be placed into a directory named "out"
39+ # ##
40+ FROM base AS prune
4541WORKDIR /app
42+ RUN pnpm install turbo --global
43+ COPY . .
44+ RUN turbo prune containers-starter
45+
46+ # ##
47+ # STAGE: INSTALL & RUN
48+ # ##
49+ FROM base AS installer
50+ WORKDIR /app
51+ # /out/json contains the condensed file that is used to install packages related to sandbox-container
52+ # COPY --from=prune /app/out/json/ .
53+ COPY --from=prune /app/out/ .
54+ RUN pnpm install --frozen-lockfile
4655
47- # Expose the port your Node.js server will run on
56+ WORKDIR /app/apps/sandbox-container
4857EXPOSE 8080
4958
50- COPY . ./
51-
52- RUN npm i
53-
54- # add node and npm to path so the commands are available
55- # ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
56- # ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
57-
58- # Default command (run your Node.js server here)
59- CMD ["npm" , "run" , "start:container" ]
59+ CMD ["pnpm" , "run" , "start:container" ]
0 commit comments