From f0712e22d8c1974239204cfb4392d38d5236321c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 5 Sep 2020 12:44:40 -0700 Subject: [PATCH] perf: Improving dockerfile --- .dockerignore | 19 +++++++++++++++++++ Dockerfile | 17 ++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..9a2b306c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +__mocks__ +.git +.vscode +.github +.circleci +.DS_Store +.env* +.eslint* +.flowconfig +.log +Makefile +Procfile +app.json +build +docker-compose.yml +fakes3 +flow-typed +node_modules +setupJest.js \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c43fb0e7..68272a74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,21 @@ FROM node:14-alpine -ENV PATH /opt/outline/node_modules/.bin:/opt/node_modules/.bin:$PATH -ENV NODE_PATH /opt/outline/node_modules:/opt/node_modules ENV APP_PATH /opt/outline RUN mkdir -p $APP_PATH WORKDIR $APP_PATH -COPY . $APP_PATH -RUN yarn install --pure-lockfile -RUN yarn build -RUN cp -r /opt/outline/node_modules /opt/node_modules +COPY package.json ./ +COPY yarn.lock ./ + +RUN yarn --pure-lockfile + +COPY . . + +RUN yarn build && \ + yarn --production --ignore-scripts --prefer-offline + ENV NODE_ENV production - CMD yarn start EXPOSE 3000