Skip to content

Commit 35631c9

Browse files
authored
Merge pull request #3 from MinecraftHopper/urielsalis-patch-1
Optimize docker image size
2 parents 900329e + 91452d7 commit 35631c9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Dockerfile

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
FROM node:14
1+
FROM node:14 AS BUILD_IMAGE
22

33
ENV VERSION=v3.6.1
44

5+
WORKDIR /usr/src/app
6+
57
RUN git clone https://github.com/Dragory/modmailbot && \
68
cd modmailbot && \
79
git checkout ${VERSION} && \
8-
npm ci
10+
npm install -g minify-all node-prune && \
11+
npm ci --only=production && \
12+
npm prune --production && \
13+
node-prune && \
14+
minify-all
15+
916

17+
FROM node:14-alpine
1018
ENV MM_MAIN_SERVER_ID=
1119
ENV MM_INBOX_SERVER_ID=
1220
ENV MM_LOG_CHANNEL_ID=
@@ -19,6 +27,8 @@ ENV MM_CATEGORY_AUTOMATION__NEW_THREAD=
1927
ENV MM_STATUS="Modmail, the way to report things"
2028
ENV MM_URL=
2129

22-
WORKDIR modmailbot
30+
COPY --from=BUILD_IMAGE /usr/src/app/modmailbot /usr/src/modmailbot
31+
32+
WORKDIR /usr/src/modmailbot
2333

2434
ENTRYPOINT ["npm", "start"]

0 commit comments

Comments
 (0)