diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32b8fed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ + +FROM amd64/node:16 + +# 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 + +### +# Only copy over the Node pieces we need +# ~> Saves 35MB +### +FROM amd64/node:16-slim + +WORKDIR /app +COPY --from=0 /app . +COPY . . + +EXPOSE 3000 +CMD ["node", "./build"] \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e0c1563..53639f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "version": "0.0.1", "devDependencies": { + "@sveltejs/adapter-node": "^1.0.0-next.55", "@sveltejs/kit": "next", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", @@ -222,6 +223,16 @@ "node": ">= 8.0.0" } }, + "node_modules/@sveltejs/adapter-node": { + "version": "1.0.0-next.55", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.0.0-next.55.tgz", + "integrity": "sha512-Kmh8lx8kIY7W6rkqjC78y4dQTyjiAHD9D1WfmUTtYuDW1jAIG+YbZmPC9127kH5KOSGK4+tI8mpReDVB1lgf8g==", + "dev": true, + "dependencies": { + "esbuild": "^0.13.4", + "tiny-glob": "^0.2.9" + } + }, "node_modules/@sveltejs/kit": { "version": "1.0.0-next.194", "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.194.tgz", @@ -1467,6 +1478,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "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 + }, "node_modules/globby": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", @@ -1487,6 +1504,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "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 + }, "node_modules/graceful-fs": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", @@ -2478,6 +2501,16 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, + "node_modules/tiny-glob": { + "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" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -2806,6 +2839,16 @@ "picomatch": "^2.2.2" } }, + "@sveltejs/adapter-node": { + "version": "1.0.0-next.55", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.0.0-next.55.tgz", + "integrity": "sha512-Kmh8lx8kIY7W6rkqjC78y4dQTyjiAHD9D1WfmUTtYuDW1jAIG+YbZmPC9127kH5KOSGK4+tI8mpReDVB1lgf8g==", + "dev": true, + "requires": { + "esbuild": "^0.13.4", + "tiny-glob": "^0.2.9" + } + }, "@sveltejs/kit": { "version": "1.0.0-next.194", "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.0.0-next.194.tgz", @@ -3656,6 +3699,12 @@ "type-fest": "^0.20.2" } }, + "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 + }, "globby": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", @@ -3670,6 +3719,12 @@ "slash": "^3.0.0" } }, + "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 + }, "graceful-fs": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", @@ -4358,6 +4413,16 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, + "tiny-glob": { + "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" + } + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index f4dccc8..cdba9c1 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ." }, "devDependencies": { + "@sveltejs/adapter-node": "^1.0.0-next.55", "@sveltejs/kit": "next", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", diff --git a/svelte.config.js b/svelte.config.js index 5eb051a..f111866 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,4 +1,5 @@ import preprocess from 'svelte-preprocess'; +import adapter from '@sveltejs/adapter-node'; /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -8,7 +9,11 @@ const config = { kit: { // hydrate the
element in src/app.html - target: '#svelte' + target: '#svelte', + adapter: adapter({ + out: 'build', + precompress: true + }) } };