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 curl ca-certificates \
1319 git \
1420 htop \
1521 vim \
@@ -18,42 +24,35 @@ RUN apt-get update && apt-get install -y \
1824 build-essential \
1925 nmap \
2026 sudo \
21- ca-certificates \
2227 lsb-release \
23- nodejs \
24- npm \
2528 python3 \
2629 python3-pip \
30+ python3-matplotlib \
31+ python3-numpy \
32+ python3-pandas \
2733 && apt-get clean
2834
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+ # STAGE: PRUNE - Generate a partial monorepo for the sandbox-container app. The output will be placed into a directory named "out"
37+ # ##
38+ FROM base AS prune
39+ WORKDIR /app
40+ RUN pnpm install turbo --global
41+ COPY . .
42+ RUN turbo prune containers-starter
43+
44+ # ##
45+ # STAGE: INSTALL & RUN
46+ # ##
47+ FROM base AS installer
48+ WORKDIR /app
3549
36- # ENV NODE_VERSION 22.14.0
50+ COPY --from=prune /app/out/ .
51+ RUN pnpm install --frozen-lockfile
3752
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
45- WORKDIR /app
53+ WORKDIR /app/apps/sandbox-container
4654
4755# Expose the port your Node.js server will run on
4856EXPOSE 8080
4957
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" ]
58+ CMD ["pnpm" , "run" , "start:container" ]
0 commit comments