Skip to content

Commit 0ac8a9b

Browse files
build: reduce image size (#133)
* build: reduce image size; upgrade node * build(Dockerfile): fix `as` casing
1 parent 20aa3e1 commit 0ac8a9b

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

Dockerfile

+14-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1-
FROM node:20.8.1-bookworm-slim
2-
1+
FROM node:20.15.0-bookworm-slim AS base
2+
RUN adduser --disabled-password -home /home/cfu -shell /bin/bash cfu
33
WORKDIR /root/cf-runtime
4-
5-
RUN apt-get update && apt upgrade -y && \
6-
apt-get install g++ git make python3 -y
7-
84
COPY package.json yarn.lock ./
95

10-
# install cf-runtime required binaries
11-
RUN yarn install --frozen-lockfile --production && \
12-
yarn cache clean && \
13-
apt-get purge g++ git make python3 -y && \
14-
apt-get autoremove -y && \
15-
apt-get clean -y && \
16-
rm -rf /tmp/* && \
17-
rm -rf /var/lib/apt/lists/*
6+
FROM base AS dependencies
7+
RUN apt-get update \
8+
&& apt upgrade -y \
9+
&& apt-get install -y \
10+
g++ \
11+
git \
12+
make \
13+
python3
14+
RUN yarn install --frozen-lockfile --production
1815

19-
# copy app files
20-
COPY . ./
21-
22-
RUN adduser --disabled-password -home /home/cfu -shell /bin/bash cfu
16+
FROM base AS production
17+
COPY --from=dependencies /root/cf-runtime/node_modules ./node_modules
18+
COPY . .
2319

2420
USER cfu
25-
2621
CMD ["node", "lib/index.js"]

service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 1.11.4
1+
version: 1.11.5

0 commit comments

Comments
 (0)