From 8763269e4c7bb8560290de17fd0203df221a065c Mon Sep 17 00:00:00 2001 From: Talon Date: Mon, 26 Aug 2024 11:20:12 +0200 Subject: [PATCH] Update dockerfile and add gitignore --- .gitignore | 1 + backend/db.sqlite | Bin 53248 -> 0 bytes backend/package-lock.json | 324 +++++++++++++++++++++++++++++++++++++- dockerfile | 27 ++-- 4 files changed, 338 insertions(+), 14 deletions(-) delete mode 100644 backend/db.sqlite diff --git a/.gitignore b/.gitignore index cec8aaf..da1875b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules backend/database.db +backend/db.sqlite backend/uploads/ .DS_Store frontend/dist/ diff --git a/backend/db.sqlite b/backend/db.sqlite deleted file mode 100644 index 99f11204ca9b344eb332260aa2ad7df91ce24203..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 53248 zcmeI*Piz}m9S89FS37q8Oj;2cw94`hRJK{Cb?hWff{^N_ZflV^!FIM3X%&s_XM0q8 z#yc}kX(a>+3qmUn9Jp{q91#*1v^Q3JKwS5ZgoIW|i-h2?z3g(~_r{(i>I^Ltgv6(EtP4{onpC`85V7H49nu((#ak{x@~#f@>s3-t)OVj?DErcth~Ry z9TaxB;qhj{V|OX2T4|@q?iTMA_P1*+)ubHH?D166vY#X~EZMaiMpvXH)9KOv_jW7A z(*3d@Wa=cMG^-Tv6)VN^R&SlovWf+ ztofapji+a(8;!?Iy>Nw`}xI3pK{0mRv#kB|qrk_>JNodpaEoeJnE^y>&s8gLpKN&&x+w!$+^> zxd#o~YMJemBY2t=4>g^fP$HRneD-aWVTWnZ*LSaK725 z-Ehe*RO=`$c0t3VB1w9&PkJY3nEQ;~+1|aAK8j976H80-QQ>^sX7f9tcIo-l1#MDx zGUf8N*~~DHJG~6+w=Fw!w(DoJ(_;v3G@7`1b25VA(LoyyUgPRvN9H5`N$_}2k0ufc z`K|By!TLjo|0^7(pY&ghF+A=J&qpHdbm%!v3q~JtQX9#iAB0Ayw3Bh@e|0vZ42P_|J3NgAuglM>K*8^+5pfoL9U5=_XZAcGSd=?c27*Bvs=uy>2vf!liy$uc+zFA zKV^>kY(7aub}W%Mz!A*PC%4trwKbgT~5CT5;7&-Pnt(5KLjkzq}TCes8BxMr{4 z<*eQvaOQSQ$D^V&^PJ`kT1|IYkBG8i+g+;1qUmoGi%4;7yLW@tXsc_sJDzE^Mf6Rx z#|*1U6WALA(MHpBc*CRMsLqZ_lY;zNUZODd*6@0^+wX9Pi%Lz4X7w2j>W9Pnj(JF% z)K{vrZP3gyziv?%Rcf~=gkhgtvq^aFpiPq-{TL{oo`{FlDKOjh1f$on2O^0o_Pa|> z)LrfziZEOP_BvwA9(bZQzjG~ztZpc|Y;I*KyS|iLW7+KH^4jLg`m1V0iX~$Ck~nN* z`Ky~NtFI~|Uz(Vo-^}J0Wy)WW@;z=p8QVR#xssjL|0=2a`;z{V{=WXl7w{#HkRbp8 z2tWV=5P$##AOHafKmY!SbWkE)X6^hDGDBI%#dHvs&NHn2bd0uX=z1Rwwb2tWV=5P$## zAn;-eL^OFu))fCi9X=?^6)iS1`u>0YLvj88T>m?5V1WPxAOHafKmY;|fB*y_009U< z;Dr^?G*z0DHJWiizZL&C%?OzDKmV8Y=Mw#3fdB*`009U<00Izz00bZa0SG|g5(!MJ zugHhoaZTG2Hw1`9p>>8<@pXV$AOHafKmY;|fB*y_009U<00I!WWCH#L|NJHE6uJWe z2tWV=5P$##AOHafKmY;|fIvt9*Z(07Jb?fNAOHafKmY;|fB*y_009VGN`Zd?)FvZ1 diff --git a/backend/package-lock.json b/backend/package-lock.json index fb2c738..0671f6f 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -30,6 +30,15 @@ "typescript": "^5.5.4" } }, + "node_modules/@emnapi/runtime": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz", + "integrity": "sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", @@ -410,6 +419,27 @@ "@img/sharp-libvips-darwin-arm64": "1.0.4" } }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" + } + }, "node_modules/@img/sharp-libvips-darwin-arm64": { "version": "1.0.4", "cpu": [ @@ -424,6 +454,291 @@ "url": "https://opencollective.com/libvips" } }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", + "cpu": [ + "wasm32" + ], + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.2.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, "node_modules/@types/better-sqlite3": { "version": "7.6.11", "license": "MIT", @@ -1766,8 +2081,9 @@ }, "node_modules/sharp": { "version": "0.33.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", + "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", "hasInstallScript": true, - "license": "Apache-2.0", "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", @@ -1943,6 +2259,12 @@ "version": "0.0.3", "license": "MIT" }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "optional": true + }, "node_modules/tsx": { "version": "4.18.0", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.18.0.tgz", diff --git a/dockerfile b/dockerfile index f620d72..5f3f412 100644 --- a/dockerfile +++ b/dockerfile @@ -1,5 +1,5 @@ -# Use the official Bun image -FROM oven/bun:1 AS base +# Use the official Node.js image +FROM node:18 AS base WORKDIR /usr/src/app # Install dependencies into temp directories @@ -7,26 +7,26 @@ WORKDIR /usr/src/app FROM base AS install # Install dependencies for both backend and frontend -COPY backend/package.json backend/bun.lockb /temp/dev/backend/ -COPY frontend/package.json frontend/bun.lockb /temp/dev/frontend/ +COPY backend/package.json backend/package-lock.json /temp/dev/backend/ +COPY frontend/package.json frontend/package-lock.json /temp/dev/frontend/ -RUN cd /temp/dev/backend && bun install -RUN cd /temp/dev/frontend && bun install +RUN cd /temp/dev/backend && npm install +RUN cd /temp/dev/frontend && npm install # Install with --production (exclude devDependencies) RUN mkdir -p /temp/prod/backend /temp/prod/frontend -COPY backend/package.json backend/bun.lockb /temp/prod/backend/ -COPY frontend/package.json frontend/bun.lockb /temp/prod/frontend/ +COPY backend/package.json backend/package-lock.json /temp/prod/backend/ +COPY frontend/package.json frontend/package-lock.json /temp/prod/frontend/ -RUN cd /temp/prod/backend && bun install -RUN cd /temp/prod/frontend && bun install +RUN cd /temp/prod/backend && npm install --production +RUN cd /temp/prod/frontend && npm install --production # Build the frontend project FROM install AS build-frontend WORKDIR /usr/src/app/frontend COPY --from=install /temp/dev/frontend/node_modules node_modules COPY frontend/ . -RUN bun run build +RUN npm run build # Prepare for final release FROM base AS release @@ -43,6 +43,7 @@ COPY backend/ backend/ COPY --from=build-frontend /usr/src/app/frontend/dist backend/public # Set the entrypoint to run the backend server -USER bun +USER node +WORKDIR /usr/src/app/backend EXPOSE 3000/tcp -ENTRYPOINT [ "bun", "run", "backend/src/server.ts" ] +ENTRYPOINT [ "npm", "run", "start"]