mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-28 03:12:43 +01:00
Remove buildServer and update docker and workflows
This commit is contained in:
1 parent
3c5d191c33
commit
99e2c45482
4 files changed
+4
-48
No files matched your search
@@ -19,6 +19,8 @@ on:
|
||||
- server/**
|
||||
- index.js
|
||||
- package.json
|
||||
- tsconfig.server.json
|
||||
- Dockerfile
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -12,6 +12,7 @@ on:
|
||||
- test/**
|
||||
- index.js
|
||||
- package.json
|
||||
- tsconfig.server.json
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
+1
-2
@@ -26,7 +26,6 @@ RUN apk add --no-cache --update \
|
||||
|
||||
WORKDIR /server
|
||||
COPY index.js package* tsconfig.server.json /server
|
||||
COPY /scripts /server/scripts
|
||||
COPY /server /server/server
|
||||
|
||||
RUN case "$TARGETPLATFORM" in \
|
||||
@@ -39,7 +38,7 @@ RUN case "$TARGETPLATFORM" in \
|
||||
unzip /tmp/library.zip -d $NUSQLITE3_DIR && \
|
||||
rm /tmp/library.zip
|
||||
|
||||
RUN npm ci --include=dev && npm run build:server && npm prune --omit=dev && rm -rf dist-server/test
|
||||
RUN npm ci --include=dev && npm run build:server && npm prune --omit=dev
|
||||
|
||||
### STAGE 2: Create minimal runtime image ###
|
||||
FROM node:20-alpine
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { spawnSync } = require('child_process')
|
||||
|
||||
const projectRoot = path.resolve(__dirname, '..')
|
||||
const outputDirectory = path.join(projectRoot, 'dist-server')
|
||||
|
||||
fs.rmSync(outputDirectory, { recursive: true, force: true })
|
||||
fs.mkdirSync(outputDirectory, { recursive: true })
|
||||
fs.copyFileSync(path.join(projectRoot, 'package.json'), path.join(outputDirectory, 'package.json'))
|
||||
fs.copyFileSync(path.join(projectRoot, 'index.js'), path.join(outputDirectory, 'index.js'))
|
||||
|
||||
const devConfigPath = path.join(projectRoot, 'dev.js')
|
||||
if (fs.existsSync(devConfigPath)) {
|
||||
fs.copyFileSync(devConfigPath, path.join(outputDirectory, 'dev.js'))
|
||||
}
|
||||
|
||||
fs.cpSync(path.join(projectRoot, 'server'), path.join(outputDirectory, 'server'), {
|
||||
recursive: true,
|
||||
force: true
|
||||
})
|
||||
|
||||
const testDirectory = path.join(projectRoot, 'test')
|
||||
if (fs.existsSync(testDirectory)) {
|
||||
fs.cpSync(testDirectory, path.join(outputDirectory, 'test'), {
|
||||
recursive: true,
|
||||
force: true
|
||||
})
|
||||
}
|
||||
|
||||
function hasTypeScriptSource(directory) {
|
||||
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
||||
const entryPath = path.join(directory, entry.name)
|
||||
if (entry.isDirectory() && hasTypeScriptSource(entryPath)) return true
|
||||
if (entry.isFile() && entry.name.endsWith('.ts')) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
if (hasTypeScriptSource(path.join(projectRoot, 'server'))) {
|
||||
const result = spawnSync(process.execPath, [require.resolve('typescript/bin/tsc'), '--project', 'tsconfig.server.json'], {
|
||||
cwd: projectRoot,
|
||||
stdio: 'inherit'
|
||||
})
|
||||
process.exit(result.status || 0)
|
||||
}
|
||||
Reference in new issue
Block a user