use prod version on docker

This commit is contained in:
KingKDot
2026-04-18 21:50:33 -05:00
parent 39d8820e56
commit e8a77fd45c
3 changed files with 24 additions and 7 deletions
+11 -4
View File
@@ -99,8 +99,15 @@ RUN if [ -f dist-clients/HVNCCapture.x64.dll ]; then \
# Create necessary directories
RUN mkdir -p certs public data
# Build production server bundle and ensure Tailwind CSS + vendor assets are present
RUN bun run build && test -s ./public/assets/tailwind.css && test -d ./public/vendor/fontawesome
# Build Tailwind CSS and vendor assets
RUN bun run build:css && bun run vendor \
&& test -s ./public/assets/tailwind.css && test -d ./public/vendor/fontawesome
# Compile a standalone production binary (sharp is external — kept in node_modules)
RUN BUN_TARGET="bun-linux-x64" \
&& if [ "${TARGETARCH}" = "arm64" ]; then BUN_TARGET="bun-linux-arm64"; fi \
&& bun build --production --minify --external sharp src/index.ts \
--compile --target "$BUN_TARGET" --outfile overlord-server
# Expose the default port
EXPOSE 5173
@@ -111,5 +118,5 @@ ENV HOST=0.0.0.0
ENV DATA_DIR=/app/data
ENV NODE_ENV=production
# Run the production build
CMD ["bun", "run", "dist/index.js"]
# Run the compiled production binary
CMD ["./overlord-server"]
+3 -3
View File
@@ -6,10 +6,10 @@
"scripts": {
"dev": "bun --watch src/index.ts",
"start": "bun run build:css && bun run vendor && bun run src/index.ts",
"build": "bun run build:css && bun run vendor && bun build --production --minify src/index.ts --target bun --outdir dist",
"build": "bun run build:css && bun run vendor && bun build --production --minify --external sharp src/index.ts --target bun --outdir dist",
"vendor": "bun run scripts/vendor.ts",
"build:prod:win": "bun build --production --minify src/index.ts --compile --target bun-windows-x64 --outfile dist/overlord-server.exe",
"build:prod:linux": "bun build --production --minify src/index.ts --compile --target bun-linux-x64 --outfile dist/overlord-server-linux-x64",
"build:prod:win": "bun build --production --minify --external sharp src/index.ts --compile --target bun-windows-x64 --outfile dist/overlord-server.exe",
"build:prod:linux": "bun build --production --minify --external sharp src/index.ts --compile --target bun-linux-x64 --outfile dist/overlord-server-linux-x64",
"build:css": "tailwindcss -i ./src/styles.css -o ./public/assets/tailwind.css --minify",
"watch:css": "tailwindcss -i ./src/styles.css -o ./public/assets/tailwind.css --watch"
},
+10
View File
@@ -56,6 +56,16 @@ if errorlevel 1 goto :err
copy /Y "%SERVER_SRC%\dist\overlord-server-linux-x64" "%RELEASE_DIR%\overlord-server-linux-x64" >nul
if errorlevel 1 goto :err
echo [6b/10] Copying sharp native module for runtime resolution...
if exist "%SERVER_SRC%\node_modules\sharp" (
robocopy "%SERVER_SRC%\node_modules\sharp" "%RELEASE_DIR%\node_modules\sharp" /E >nul
if errorlevel 8 goto :robocopy_err
)
if exist "%SERVER_SRC%\node_modules\@img" (
robocopy "%SERVER_SRC%\node_modules\@img" "%RELEASE_DIR%\node_modules\@img" /E >nul
if errorlevel 8 goto :robocopy_err
)
echo [7/10] Exporting Overlord-Client source for runtime builds...
robocopy "%CLIENT_SRC%" "%RELEASE_DIR%\Overlord-Client" /E /XD build .git .vscode >nul
if errorlevel 8 goto :robocopy_err