From 4a3a603d7eddd4c0d2146561073fa2db74c7e28b Mon Sep 17 00:00:00 2001 From: nick-funk Date: Wed, 6 Sep 2023 09:52:32 -0600 Subject: [PATCH 1/3] set working directory to server in docker build --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 1a56483220..866b7ba3c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,6 +62,9 @@ RUN cd server && \ npm prune --production && \ cd .. +# Set working directory within server folder +WORKDIR /usr/src/app/server + # Setup the environment ENV NODE_ENV production ENV PORT 5000 From 7ae42dcc957f8aaf108a7b99a29f194b3837aeaa Mon Sep 17 00:00:00 2001 From: nick-funk Date: Wed, 6 Sep 2023 09:53:36 -0600 Subject: [PATCH 2/3] update dockerignore so it recurses into mono-repo files should stop this from generating 6+ GB docker images --- .dockerignore | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 7d259f4a06..0a64dffc37 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,15 +1,20 @@ # tests are not run in the docker container. __tests__ +**/__tests__ +**/coverage coverage # we won't use the .git folder in production. .git +.github # don't include the dependancies node_modules +**/node_modules # don't include any logs npm-debug.log* +**/npm-debug.log* # don't include any yarn files yarn-error.log @@ -17,14 +22,30 @@ yarn.lock # don't include any OS/editor files .env +**/.env .idea/ .vs +.vscode + .docz +**/.docz + *.swp +**/*.swp + *.DS_STORE +*.DS_Store +**/*.DS_STORE +**/*.DS_Store # don't include any generated files dist +**/dist + *.css.d.ts +**/*.css.d.ts + __generated__ -docs/.next \ No newline at end of file +**/__generated__ + +**/.next \ No newline at end of file From 33f8d1aa0ebee07206d85c2fbf90f0e6218a16a9 Mon Sep 17 00:00:00 2001 From: nick-funk Date: Wed, 6 Sep 2023 10:34:10 -0600 Subject: [PATCH 3/3] retarget docker CMD now that working directory is `server` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 866b7ba3c6..68ce9fd9f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,4 +72,4 @@ EXPOSE 5000 # Run the node process directly instead of using `npm run start`: # SEE: https://github.com/nodejs/docker-node/blob/a2eb9f80b0fd224503ee2678867096c9e19a51c2/docs/BestPractices.md#cmd -CMD ["node", "server/dist/index.js"] +CMD ["node", "dist/index.js"]