-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile.kfc
53 lines (41 loc) · 1.95 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
### 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
FROM cgr.dev/chainguard/node:latest-dev@sha256:96260affdd273eb612d5fa031b8230cde59e06e21cdaf67f85a8f6399abd889a 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
FROM cgr.dev/chainguard/node:latest@sha256:f771505c29d1f766c1dc4d3b2ed0f8660a76553685b9d886728bc55d6f430ce8
WORKDIR /app
COPY --from=build --chown=node:node /app/node_modules/ ./node_modules/