Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: reduce image size #133

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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