Skip to content

Commit 0e86e9d

Browse files
Update Dockerfile to use pnpm for backend
1 parent b9ac6da commit 0e86e9d

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

Dockerfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ ENV DEBIAN_FRONTEND=noninteractive
77
RUN apt-get -o Acquire::Check-Valid-Until=false -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true update
88

99
# make g++ gcc build-essential are needed for node-gyp
10-
RUN apt-get install -y curl make g++ gcc build-essential git
11-
RUN curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
12-
RUN bash ./nodesource_setup.sh
13-
RUN apt-get install -y nodejs
10+
RUN apt-get install -y curl make g++ gcc build-essential git && \
11+
curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh && \
12+
bash ./nodesource_setup.sh && \
13+
apt-get install -y nodejs && \
14+
rm nodesource_setup.sh && \
15+
npm install -g pnpm
1416

1517
ENV user=typedai
1618
ENV homedir=/home/typedai/
@@ -22,19 +24,19 @@ RUN mkdir ".husky"
2224
COPY .husky/install.mjs .husky/install.mjs
2325

2426
COPY package*.json ./
25-
RUN npm ci
27+
RUN pnpm install
2628

2729
COPY . .
2830

2931
# Download the tiktokenizer model, which is written to node_modules/@microsoft/tiktokenizer/model,
3032
# as the root user, as the typedai user can't write to node_modules
31-
RUN npm run initTiktokenizer
33+
RUN pnpm run initTiktokenizer
3234

3335
USER $user
3436

3537
RUN mkdir .typedai
3638
# Generate the function schemas
37-
RUN npm run functionSchemas
39+
RUN pnpm run functionSchemas
3840

3941
# Needed to avoid the error "fatal: detected dubious ownership in repository at '/home/typedai'" when running git commands
4042
# as the application files are owned by the root user so an agent (which runs as the typedai user) can't modify them.
@@ -43,4 +45,4 @@ RUN git config --global --add safe.directory /home/typedai
4345
ENV NODE_ENV=production
4446
ENV PORT=8080
4547
EXPOSE 8080
46-
CMD [ "npm", "run", "start" ]
48+
CMD [ "pnpm", "run", "start" ]

Dockerfile.dev

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ RUN apt-get install -y --no-install-recommends \
2020
RUN curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh \
2121
&& bash ./nodesource_setup.sh \
2222
&& apt-get install -y nodejs \
23-
&& rm nodesource_setup.sh
23+
&& rm nodesource_setup.sh \
24+
&& npm install -g pnpm
2425

2526
# Define user and home directory consistently
2627
ENV USER_NAME=typedai
@@ -57,7 +58,7 @@ RUN chown ${USER_NAME}:users package.json package-lock.json 2>/dev/null || chown
5758
USER ${USER_NAME}
5859

5960
# Now, as the user, install npm dependencies
60-
RUN npm install
61+
RUN pnpm install
6162

6263
# Install Angular dependencies and build Angular app
6364
# Ensure frontend/package.json exists in your TYPEDAI_HOME/frontend
@@ -68,7 +69,7 @@ COPY --chown=${USER_NAME}:users frontend/package.json ./
6869
# If it doesn't exist, this COPY command will fail. If it's optional, remove this line.
6970
COPY --chown=${USER_NAME}:users frontend/package-lock.json ./
7071

71-
RUN npm install
72+
RUN pnpm install
7273
# RUN npm run build # If you need to build frontend during Docker image creation
7374

7475
# Set work directory back to home

bin/cmd-script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ restart_server() {
99
trap restart_server SIGUSR1
1010

1111
cd frontend && npm run start:local &
12-
npm run start:local &
12+
pnpm run start:local &
1313
wait

0 commit comments

Comments
 (0)