-FROM node:14\r
-WORKDIR /usr/src/app_name\r
-COPY . .\r
+FROM node:14-alpine as builder\r
+RUN apk update && apk add yarn curl bash && rm -rf /var/cache/apk/*\r
+\r
+RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin\r
+\r
+WORKDIR /usr/src/app\r
+\r
+# Cache deps\r
+COPY package.json yarn.lock ./\r
+RUN yarn install --pure-lockfile\r
+\r
+# Build \r
+COPY generate_translations.js \\r
+ tsconfig.json \\r
+ webpack.config.js \\r
+ .babelrc \\r
+ .\r
+COPY translations translations\r
+COPY src src\r
+\r
RUN yarn\r
-RUN yarn build:server\r
-RUN yarn build:client\r
+RUN yarn build\r
+\r
+# Pruning\r
+# RUN npm prune --production\r
+RUN /usr/local/bin/node-prune\r
+\r
+FROM node:14-alpine as runner\r
+COPY --from=builder /usr/src/app/dist /app/dist\r
+COPY --from=builder /usr/src/app/node_modules /app/node_modules\r
+\r
EXPOSE 1234\r
-CMD yarn serve\r
+CMD node /app/dist/js/server.js\r