Skip to content

Commit 41d4332

Browse files
committed
Added multi stage docker build
1 parent d00991d commit 41d4332

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
FROM node:alpine
1+
# Do npm install with full image
2+
FROM mhart/alpine-node:latest
23
LABEL maintainer="jakewmeyer@gmail.com"
3-
# Needs password as placeholder for redis-connection
44
ENV REDISCLOUD_URL=redis://default:default@redis_db:6379
5-
WORKDIR /usr/src/app
6-
COPY package*.json ./
5+
WORKDIR /app
6+
COPY package.json package-lock.json ./
77
RUN npm install --production
8+
9+
# And then copy over node_modules, etc from that stage to the smaller base image
10+
FROM mhart/alpine-node:base
11+
WORKDIR /app
12+
COPY --from=0 /app .
813
COPY . .
914
EXPOSE 5000
10-
CMD [ "npm", "start" ]
15+
CMD ["node", "src/app.js"]

0 commit comments

Comments
 (0)