From 2a612bf0ee9e402ef8a01edf3c09b559281abf42 Mon Sep 17 00:00:00 2001 From: Maxime Cannoodt Date: Thu, 30 Jun 2022 22:08:52 +0200 Subject: [PATCH] svelte dockerfile --- webapp/.dockerignore | 2 ++ webapp/Dockerfile | 24 ++++++++++++++++++++++++ webapp/package-lock.json | 31 +++++++++++++++++++++---------- webapp/package.json | 1 + webapp/svelte.config.js | 3 ++- 5 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 webapp/.dockerignore create mode 100644 webapp/Dockerfile diff --git a/webapp/.dockerignore b/webapp/.dockerignore new file mode 100644 index 0000000..5171c54 --- /dev/null +++ b/webapp/.dockerignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log \ No newline at end of file diff --git a/webapp/Dockerfile b/webapp/Dockerfile new file mode 100644 index 0000000..9e24a15 --- /dev/null +++ b/webapp/Dockerfile @@ -0,0 +1,24 @@ +FROM node:16-alpine AS BUILD_IMAGE + + +# install dependencies +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci + +# Copy all local files into the image. +COPY . . + +RUN npm run build + +# remove development dependencies +RUN npm prune --production + +FROM node:16-alpine + +WORKDIR /app +COPY --from=0 /app . +COPY . . + +EXPOSE 3000 +CMD ["node", "./build"] \ No newline at end of file diff --git a/webapp/package-lock.json b/webapp/package-lock.json index 4d06726..d117178 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -8,6 +8,7 @@ "name": "obsidian-note-sharing-server", "version": "0.0.1", "dependencies": { + "@sveltejs/adapter-node": "^1.0.0-next.78", "crypto-js": "^4.1.1", "katex": "^0.16.0", "marked": "^4.0.17", @@ -209,6 +210,14 @@ "tiny-glob": "^0.2.9" } }, + "node_modules/@sveltejs/adapter-node": { + "version": "1.0.0-next.78", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.0.0-next.78.tgz", + "integrity": "sha512-TXB5Ii0z/7o1B05p/YLsS4t+JUHFHWBzFv1U16TKvM3HMbMUJIx+AhpM2WJfDX8HtAyfd1m9OawGoUB+1ed24A==", + "dependencies": { + "tiny-glob": "^0.2.9" + } + }, "node_modules/@sveltejs/adapter-vercel": { "version": "1.0.0-next.58", "resolved": "https://registry.npmjs.org/@sveltejs/adapter-vercel/-/adapter-vercel-1.0.0-next.58.tgz", @@ -1959,8 +1968,7 @@ "node_modules/globalyzer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", - "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", - "dev": true + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==" }, "node_modules/globby": { "version": "11.1.0", @@ -1985,8 +1993,7 @@ "node_modules/globrex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", - "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", - "dev": true + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==" }, "node_modules/graceful-fs": { "version": "4.2.10", @@ -3871,7 +3878,6 @@ "version": "0.2.9", "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", - "dev": true, "dependencies": { "globalyzer": "0.1.0", "globrex": "^0.1.2" @@ -4259,6 +4265,14 @@ "tiny-glob": "^0.2.9" } }, + "@sveltejs/adapter-node": { + "version": "1.0.0-next.78", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.0.0-next.78.tgz", + "integrity": "sha512-TXB5Ii0z/7o1B05p/YLsS4t+JUHFHWBzFv1U16TKvM3HMbMUJIx+AhpM2WJfDX8HtAyfd1m9OawGoUB+1ed24A==", + "requires": { + "tiny-glob": "^0.2.9" + } + }, "@sveltejs/adapter-vercel": { "version": "1.0.0-next.58", "resolved": "https://registry.npmjs.org/@sveltejs/adapter-vercel/-/adapter-vercel-1.0.0-next.58.tgz", @@ -5419,8 +5433,7 @@ "globalyzer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", - "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", - "dev": true + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==" }, "globby": { "version": "11.1.0", @@ -5439,8 +5452,7 @@ "globrex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", - "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", - "dev": true + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==" }, "graceful-fs": { "version": "4.2.10", @@ -6809,7 +6821,6 @@ "version": "0.2.9", "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", - "dev": true, "requires": { "globalyzer": "0.1.0", "globrex": "^0.1.2" diff --git a/webapp/package.json b/webapp/package.json index 9e44e02..83db263 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -36,6 +36,7 @@ }, "type": "module", "dependencies": { + "@sveltejs/adapter-node": "^1.0.0-next.78", "crypto-js": "^4.1.1", "katex": "^0.16.0", "marked": "^4.0.17", diff --git a/webapp/svelte.config.js b/webapp/svelte.config.js index 0d27411..478fd4d 100644 --- a/webapp/svelte.config.js +++ b/webapp/svelte.config.js @@ -1,4 +1,5 @@ -import adapter from '@sveltejs/adapter-auto'; +// import adapter from '@sveltejs/adapter-auto'; +import adapter from '@sveltejs/adapter-node'; import preprocess from 'svelte-preprocess'; /** @type {import('@sveltejs/kit').Config} */