Build to docker
This commit is contained in:
parent
8f6a5aebb8
commit
2079968b5a
11
Dockerfile
11
Dockerfile
@ -5,11 +5,14 @@ RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:14
|
||||
FROM node:22
|
||||
RUN apt-get update && apt-get install -y ghostscript
|
||||
WORKDIR /usr/src/app
|
||||
COPY --from=builder /usr/src/app/package*.json ./
|
||||
COPY --from=builder /usr/src/app/build ./dist
|
||||
RUN npm install --only=production
|
||||
COPY --from=builder /usr/src/app/build ./
|
||||
COPY ./sh ./sh
|
||||
COPY ./views ./views
|
||||
COPY ./static ./static
|
||||
RUN npm install --omit=dev
|
||||
EXPOSE 3000
|
||||
CMD ["node", "dist/index.js"]
|
||||
CMD ["node", "./index.js"]
|
8
jobs.ts
8
jobs.ts
@ -65,8 +65,8 @@ export class JobManager {
|
||||
|
||||
const presets: { [preset: string]: string } = {
|
||||
screen: './sh/screen.sh',
|
||||
print: './print_ghostscript.sh',
|
||||
monochrome: './monochrome_ghostscript.sh'
|
||||
print: './sh/print.sh',
|
||||
monochrome: './sh/monochrome.sh'
|
||||
};
|
||||
|
||||
export function createJobId(): string {
|
||||
@ -76,8 +76,8 @@ export function createJobId(): string {
|
||||
export async function runGhostscript(ctx: context, opts: options): Promise<void> {
|
||||
ctx.jobManager.create_job(ctx.jobId)
|
||||
ctx.jobManager.set_job_state(ctx.jobId, "pending")
|
||||
|
||||
await delay(1000)
|
||||
// Add some kind of limit here to prevent too many jobs from being spawned
|
||||
await delay(7500) // Currently a rate limiting delay is introduced
|
||||
const inputFilePath = `./uploads/${ctx.jobId}/in.pdf`
|
||||
const outputFilePath = `./uploads/${ctx.jobId}/out.pdf`
|
||||
ctx.jobManager.set_job_state(ctx.jobId, "running")
|
||||
|
@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "npx tsc && cp -r static/ build && node build/index.js",
|
||||
"build": "npx tsc && cp -r static/ views/ sh/ build"
|
||||
"build": "npx tsc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -12,7 +12,7 @@ gs -sDEVICE=pdfwrite \
|
||||
-dCompatibilityLevel=1.4 \
|
||||
-dPDFSETTINGS=/ebook \
|
||||
-dConvertCMYKImagesToRGB=true \
|
||||
-dColorConversionStrategy=/DeviceGray \ # Adjust color conversion strategy
|
||||
-dColorConversionStrategy=/DeviceGray \
|
||||
-dEmbedAllFonts=true \
|
||||
-dSubsetFonts=true \
|
||||
-dFastWebView=true \
|
||||
|
Loading…
Reference in New Issue
Block a user