Skip to content

Commit

Permalink
build: reduce image size (#133)
Browse files Browse the repository at this point in the history
* build: reduce image size; upgrade node

* build(Dockerfile): fix `as` casing
  • Loading branch information
masontikhonov authored Jul 3, 2024
1 parent 20aa3e1 commit 0ac8a9b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
33 changes: 14 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
FROM node:20.8.1-bookworm-slim

FROM node:20.15.0-bookworm-slim AS base
RUN adduser --disabled-password -home /home/cfu -shell /bin/bash cfu
WORKDIR /root/cf-runtime

RUN apt-get update && apt upgrade -y && \
apt-get install g++ git make python3 -y

COPY package.json yarn.lock ./

# install cf-runtime required binaries
RUN yarn install --frozen-lockfile --production && \
yarn cache clean && \
apt-get purge g++ git make python3 -y && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /tmp/* && \
rm -rf /var/lib/apt/lists/*
FROM base AS dependencies
RUN apt-get update \
&& apt upgrade -y \
&& apt-get install -y \
g++ \
git \
make \
python3
RUN yarn install --frozen-lockfile --production

# copy app files
COPY . ./

RUN adduser --disabled-password -home /home/cfu -shell /bin/bash cfu
FROM base AS production
COPY --from=dependencies /root/cf-runtime/node_modules ./node_modules
COPY . .

USER cfu

CMD ["node", "lib/index.js"]
2 changes: 1 addition & 1 deletion service.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 1.11.4
version: 1.11.5

0 comments on commit 0ac8a9b

Please sign in to comment.