File tree Expand file tree Collapse file tree 3 files changed +33
-7
lines changed
Expand file tree Collapse file tree 3 files changed +33
-7
lines changed Original file line number Diff line number Diff line change 1+ # Folders to ignore when copying in the Dockerfile in the builder stage
2+ node_modules
3+ dist
4+ coverage
Original file line number Diff line number Diff line change 77 branches : [ "main" ]
88
99jobs :
10- test :
10+ test-build :
1111 runs-on : ubuntu-latest
1212
1313 steps :
2727 - name : Run test with coverage
2828 run : npm run test:cov
2929
30- build :
30+ - name : Run Build
31+ run : npm run build
32+
33+ docker :
3134 runs-on : ubuntu-latest
3235
3336 steps :
3841 node-version : ' 18'
3942 cache : ' npm'
4043
41- - name : Install Dependencies
42- run : npm ci
43-
44- - name : Run Build
45- run : npm run build
44+ - name : Build docker image
45+ run : docker build -t typescript-project .
Original file line number Diff line number Diff line change 1+ FROM node:18-alpine AS builder
2+
3+ WORKDIR /app
4+ COPY . .
5+ RUN npm install
6+ RUN npm run build
7+
8+ FROM node:18-alpine AS production
9+
10+ ARG NODE_ENV=production
11+ RUN addgroup -S docker && adduser -S user -G docker
12+
13+ WORKDIR /app
14+
15+ COPY --from=builder --chown=user:docker /app/package*.json ./
16+ COPY --from=builder --chown=user:docker /app/dist ./dist
17+ RUN npm ci --omit=dev && npm cache clean --force
18+
19+ USER user
20+
21+ ENTRYPOINT ["node" ]
22+ CMD ["dist/index.js" ]
You can’t perform that action at this time.
0 commit comments