diff --git a/Dockerfile b/Dockerfile index 36cea56..079f242 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,20 @@ -FROM node:14 +FROM node:14 AS BUILD_IMAGE ENV VERSION=v3.3.2 +WORKDIR /usr/src/app + RUN git clone https://github.com/Dragory/modmailbot && \ cd modmailbot && \ git checkout ${VERSION} && \ - npm ci + npm install -g minify-all node-prune && \ + npm ci --only=production && \ + npm prune --production && \ + node-prune && \ + minify-all + +FROM node:14-alpine ENV MM_MAIN_SERVER_ID= ENV MM_INBOX_SERVER_ID= ENV MM_LOG_CHANNEL_ID= @@ -19,6 +27,8 @@ ENV MM_CATEGORY_AUTOMATION__NEW_THREAD= ENV MM_STATUS="Modmail, the way to report things" ENV MM_URL= -WORKDIR modmailbot +COPY --from=BUILD_IMAGE /usr/src/app/modmailbot /usr/src/modmailbot + +WORKDIR /usr/src/modmailbot ENTRYPOINT ["npm", "start"]