use prod version on docker
This commit is contained in:
+11
-4
@@ -99,8 +99,15 @@ RUN if [ -f dist-clients/HVNCCapture.x64.dll ]; then \
|
|||||||
# Create necessary directories
|
# Create necessary directories
|
||||||
RUN mkdir -p certs public data
|
RUN mkdir -p certs public data
|
||||||
|
|
||||||
# Build production server bundle and ensure Tailwind CSS + vendor assets are present
|
# Build Tailwind CSS and vendor assets
|
||||||
RUN bun run build && test -s ./public/assets/tailwind.css && test -d ./public/vendor/fontawesome
|
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 the default port
|
||||||
EXPOSE 5173
|
EXPOSE 5173
|
||||||
@@ -111,5 +118,5 @@ ENV HOST=0.0.0.0
|
|||||||
ENV DATA_DIR=/app/data
|
ENV DATA_DIR=/app/data
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
# Run the production build
|
# Run the compiled production binary
|
||||||
CMD ["bun", "run", "dist/index.js"]
|
CMD ["./overlord-server"]
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun --watch src/index.ts",
|
"dev": "bun --watch src/index.ts",
|
||||||
"start": "bun run build:css && bun run vendor && bun run 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",
|
"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: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 src/index.ts --compile --target bun-linux-x64 --outfile dist/overlord-server-linux-x64",
|
"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",
|
"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"
|
"watch:css": "tailwindcss -i ./src/styles.css -o ./public/assets/tailwind.css --watch"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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
|
copy /Y "%SERVER_SRC%\dist\overlord-server-linux-x64" "%RELEASE_DIR%\overlord-server-linux-x64" >nul
|
||||||
if errorlevel 1 goto :err
|
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...
|
echo [7/10] Exporting Overlord-Client source for runtime builds...
|
||||||
robocopy "%CLIENT_SRC%" "%RELEASE_DIR%\Overlord-Client" /E /XD build .git .vscode >nul
|
robocopy "%CLIENT_SRC%" "%RELEASE_DIR%\Overlord-Client" /E /XD build .git .vscode >nul
|
||||||
if errorlevel 8 goto :robocopy_err
|
if errorlevel 8 goto :robocopy_err
|
||||||
|
|||||||
Reference in New Issue
Block a user