Somewhat working dockerfile, without the networking.
authorDessalines <tyhou13@gmx.com>
Wed, 9 Sep 2020 23:56:02 +0000 (18:56 -0500)
committerDessalines <tyhou13@gmx.com>
Wed, 9 Sep 2020 23:56:02 +0000 (18:56 -0500)
.dockerignore [new file with mode: 0644]
Dockerfile

diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..f06235c
--- /dev/null
@@ -0,0 +1,2 @@
+node_modules
+dist
index 0c40fb96d0583fee903b20be67b44f7916c47992..9337b86ddda1e1e89a244b0acfae0b1475a35493 100644 (file)
@@ -1,8 +1,33 @@
-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