1
0
Fork 0
mirror of https://github.com/alangrainger/immich-public-proxy.git synced 2024-12-28 03:41:58 +00:00

Remove dev-dependencies from the final build

This commit is contained in:
Alan Grainger 2024-11-01 08:55:54 +01:00
parent 6d34cdaf88
commit ea5cb3acb8
3 changed files with 17 additions and 6 deletions

View file

@ -2,11 +2,14 @@ FROM node:lts-slim
WORKDIR /app
COPY package*.json ./
COPY package.json ./
RUN npm install --omit=dev
COPY . .
RUN npm run build
# Build without type checking, as we have removed the Typescript
# dev-dependencies above to save space in the final build
RUN npx tsc --noCheck
CMD [ "node", "dist/index.js" ]

View file

@ -5,6 +5,7 @@
"scripts": {
"dev": "ts-node src/index.ts",
"build": "npx tsc",
"test": "podman build -t immich-proxy-test . && podman run --init -it -p=3000:3000 immich-proxy-test",
"start": "node dist/index.js"
},
"author": "",
@ -15,13 +16,16 @@
"dotenv": "^16.4.5",
"dayjs": "^1.11.13",
"ejs": "^3.1.10",
"@types/express": "^4.17.21",
"typescript": "^5.6.2",
"tslib": "^2.8.1"
},
"devDependencies": {
"ts-node": "^10.9.2",
"@types/node": "^16.18.111",
"@types/express": "^4.17.21",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"eslint": "^8.49.0",
"eslint-config-standard": "^17.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
"eslint-config-standard": "^17.1.0"
}
}

View file

@ -91,6 +91,10 @@ const getSize = (req: Request) => {
*/
export const log = (message: string) => console.log(dayjs().format() + ' ' + message)
// Handle process termination requests (e.g. Ctrl+C)
process.on('SIGTERM', () => { process.exit(0) })
process.on('SIGINT', () => { process.exit(0) })
app.listen(3000, () => {
console.log(dayjs().format() + ' Server started')
})