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
3
5
4
6
# Set non-interactive mode to avoid prompts during package installation
5
7
ARG DEBIAN_FRONTEND=noninteractive
6
8
9
+ # Setup pnpm
10
+ ENV PNPM_HOME="/pnpm"
11
+ ENV PATH="$PNPM_HOME:$PATH"
12
+ RUN corepack enable
13
+
7
14
# Use bash for the shell
8
15
SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
9
16
10
17
# 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 \
13
19
git \
14
20
htop \
15
21
vim \
@@ -18,42 +24,35 @@ RUN apt-get update && apt-get install -y \
18
24
build-essential \
19
25
nmap \
20
26
sudo \
21
- ca-certificates \
22
27
lsb-release \
23
- nodejs \
24
- npm \
25
28
python3 \
26
29
python3-pip \
30
+ python3-matplotlib \
31
+ python3-numpy \
32
+ python3-pandas \
27
33
&& apt-get clean
28
34
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
35
49
36
- # ENV NODE_VERSION 22.14.0
50
+ COPY --from=prune /app/out/ .
51
+ RUN pnpm install --frozen-lockfile
37
52
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
46
54
47
55
# Expose the port your Node.js server will run on
48
56
EXPOSE 8080
49
57
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