Dockerise
continuous-integration/drone/push Build is passing Details

pull/6/head^2
Clément FRÉVILLE 10 months ago
parent c0ac68a516
commit 13788c5538

@ -0,0 +1,4 @@
node_modules
Dockerfile
.dockerignore
*.js

@ -0,0 +1,14 @@
FROM node:22-bookworm AS runner
WORKDIR /app
ENV NODE_ENV="production"
COPY package.json package-lock.json ./
RUN npm install --omit=dev
FROM runner AS builder
COPY . .
RUN npm install && npm run build && npm prune --omit=dev
FROM runner
COPY --from=builder /app/dist /app
EXPOSE 3000
ENTRYPOINT ["node", "src/server.js"]

@ -3,11 +3,12 @@
"module": "src/server.ts", "module": "src/server.ts",
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc && tsc-alias",
"start": "tsx src/server.ts" "start": "tsx src/server.ts"
}, },
"devDependencies": { "devDependencies": {
"@types/bun": "^1.0.4", "@types/bun": "^1.0.4",
"tsc-alias": "^1.8.10",
"tsx": "^4.7.0", "tsx": "^4.7.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },

@ -5,7 +5,7 @@ import { Type, TypeBoxTypeProvider } from "@fastify/type-provider-typebox";
import websocket, { WebSocket } from "@fastify/websocket"; import websocket, { WebSocket } from "@fastify/websocket";
import Fastify, { FastifyReply } from "fastify"; import Fastify, { FastifyReply } from "fastify";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
import { allocateBuffer, getRunner } from "runner"; import { allocateBuffer, getRunner } from "./runner";
import { Pull, Push } from "zeromq"; import { Pull, Push } from "zeromq";
import * as db from "./database"; import * as db from "./database";
@ -559,4 +559,4 @@ async function forwardOutput() {
} }
/* Lancer le serveur et la fonction forwardOutput sur le même thread en parallèle */ /* Lancer le serveur et la fonction forwardOutput sur le même thread en parallèle */
await Promise.all([fastify.listen({ port: 3000 }), forwardOutput()]); await Promise.all([fastify.listen({ port: 3000, host: '0.0.0.0' }), forwardOutput()]);

@ -1,15 +1,15 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": "./src", "baseUrl": "./src",
"outDir": "./dist",
"types": ["bun-types"], "types": ["bun-types"],
"lib": ["esnext"], "lib": ["esnext"],
"module": "esnext", "module": "esnext",
"target": "esnext", "target": "esnext",
"moduleResolution": "bundler", "moduleResolution": "Node",
"noEmit": true, "noEmit": false,
"allowImportingTsExtensions": true,
"moduleDetection": "force", "moduleDetection": "force",
"strict": true, "strict": true,
@ -18,5 +18,8 @@
"composite": true, "composite": true,
"downlevelIteration": true, "downlevelIteration": true,
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true
},
"tsc-alias": {
"resolveFullPaths": true
} }
} }

Loading…
Cancel
Save