Skip to content

Commit f7e3da3

Browse files
committed
alter dockerfile
1 parent d8096f7 commit f7e3da3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ FROM node:20-alpine
33
# Create app directory
44
WORKDIR /usr/src/app
55

6-
# Install app dependencies
6+
# Bundle app source
7+
COPY tsconfig.json ./
78
COPY package*.json ./
8-
RUN npm install --silent && npm cache clean --force --silent
9+
COPY src ./src
910

10-
# Bundle app source
11-
COPY . .
11+
RUN npm install && npm cache clean --force --silent
1212
RUN npm run build
1313

14-
# Remove source files
15-
RUN rm -rf src
1614
RUN npm prune --production
1715

1816
EXPOSE 8080
19-
CMD [ "node", "dist/server.js" ]
17+
CMD ["npm", "start"]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8+
"start": "node dist/index.mjs",
89
"build": "tsc"
910
},
1011
"repository": {

0 commit comments

Comments
 (0)