-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDockerfile.kfc
56 lines (44 loc) · 2.29 KB
/
Dockerfile.kfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
### BUILD ###
# NOTE:
# Used to build Controller image
# In this file, we delete the *.ts intentionally
# Any other changes to Dockerfile should be reflected in Publish
# crane digest cgr.dev/chainguard/node-lts:latest-dev
# cgr.dev/chainguard/node:latest-dev@sha256:96260affdd273eb612d5fa031b8230cde59e06e21cdaf67f85a8f6399abd889a
FROM docker.io/library/node:22-bookworm@@sha256:fa54405993eaa6bab6b6e460f5f3e945a2e2f07942ba31c0e297a7d9c2041f62 AS build
WORKDIR /app
# Copy the node config files
COPY --chown=node:node ./package*.json ./
# Install deps
RUN npm ci
COPY --chown=node:node ./hack/ ./hack/
COPY --chown=node:node ./tsconfig.json ./build.mjs ./
COPY --chown=node:node ./src/ ./src/
COPY --chown=node:node kubernetes-fluent-client/ ./kubernetes-fluent-client/
RUN cp -r kubernetes-fluent-client/src node_modules/kubernetes-fluent-client/src && \
cp -r kubernetes-fluent-client/dist node_modules/kubernetes-fluent-client/dist && \
npm run build && \
npm ci --omit=dev --omit=peer && \
cp -r kubernetes-fluent-client/src node_modules/kubernetes-fluent-client/src && \
cp -r kubernetes-fluent-client/dist node_modules/kubernetes-fluent-client/dist && \
npm cache clean --force && \
# Remove @types
rm -rf node_modules/@types && \
# Remove Ramda unused Ramda files
rm -rf node_modules/ramda/dist && \
rm -rf node_modules/ramda/es && \
rm -rf node_modules/kubernetes-fluent-client/src && \
rm -rf node_modules/kubernetes-fluent-client/dist && \
find . -name "*.ts" -type f -delete && \
mkdir node_modules/pepr && \
cp -r dist node_modules/pepr/dist && \
cp -r kubernetes-fluent-client/dist node_modules/kubernetes-fluent-client/dist && \
cp -r kubernetes-fluent-client/src node_modules/kubernetes-fluent-client/src && \
cp package.json node_modules/pepr
##### DELIVER #####
# crane digest cgr.dev/chainguard/node-lts:latest
# cgr.dev/chainguard/node:latest@sha256:f771505c29d1f766c1dc4d3b2ed0f8660a76553685b9d886728bc55d6f430ce8
# gcr.io/distroless/nodejs22-debian12@sha256:d00edbf864c5b989f1b69951a13c5c902bf369cca572de59b5ec972552848e33
FROM gcr.io/distroless/nodejs22-debian12:nonroot@sha256:06298f87531dfff6dd2bc6b573095162d25f7e5583abbc865bfcdf45a4fbee16
WORKDIR /app
COPY --from=build --chown=nonroot:nonroot /app/node_modules/ ./node_modules/