Skip to content

Commit f74208e

Browse files
committed
fix docker template
1 parent 101ec82 commit f74208e

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

template/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Dockerfile
44
node_modules
55
test
66
.vscode
7+
data

template/Dockerfile

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
FROM node:16-alpine
1+
FROM node:16 as build
22

3-
RUN mkdir /app
4-
WORKDIR /app
3+
WORKDIR /tmp/app
54

65
# Install dependencies
76
COPY package.json package-lock.json ./
@@ -10,10 +9,23 @@ RUN npm ci --silent
109
# Copy source
1110
COPY . .
1211

12+
# Build
13+
RUN npm run build
14+
15+
# -------------------
16+
FROM node:16-alpine
17+
18+
WORKDIR /app
19+
20+
# Copy source
21+
COPY . .
22+
23+
# Copy built files
24+
COPY --from=build /tmp/app/dist .
25+
1326
# Build and cleanup
1427
ENV NODE_ENV=production
15-
RUN npm run build \
16-
&& npm prune
28+
RUN npm ci --omit=dev
1729

1830
# Start server
19-
CMD ["npm", "start"]
31+
CMD ["node", "./node_modules/moleculer/bin/moleculer-runner.js"]

template/docker-compose.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
NAMESPACE=
22
LOGGER=true
33
LOGLEVEL=info
4-
SERVICEDIR=dist/services
4+
SERVICEDIR=services
5+
MOLECULER_CONFIG=moleculer.config.js
56

67
{{#if_eq transporter "NATS"}}
78
TRANSPORTER=nats://nats:4222

0 commit comments

Comments
 (0)