forked from defenseunicorns/pepr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (32 loc) · 1.25 KB
/
Dockerfile
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
### 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-lts@sha256:62bbead79896a962d2257d6e9df94264cb843a3952a072a89fee9d82a7cc9564 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/
RUN npm run build && \
npm ci --omit=dev --omit=peer && \
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 && \
find . -name "*.ts" -type f -delete && \
mkdir node_modules/pepr && \
cp -r dist node_modules/pepr/dist && \
cp package.json node_modules/pepr
##### DELIVER #####
# crane digest cgr.dev/chainguard/node-lts:latest
FROM cgr.dev/chainguard/node-lts@sha256:62bbead79896a962d2257d6e9df94264cb843a3952a072a89fee9d82a7cc9564
WORKDIR /app
COPY --from=build --chown=node:node /app/node_modules/ ./node_modules/