This commit is contained in:
maix0 2025-06-16 16:37:20 +02:00 committed by Maieul BOYER
parent aa96d79e47
commit 1bc33ab912
28 changed files with 94 additions and 18 deletions

View file

@ -0,0 +1,2 @@
/dist
/node_modules

View file

@ -0,0 +1,31 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Dockerfile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/06/16 14:57:11 by maiboyer #+# #+# #
# Updated: 2025/06/16 15:28:33 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
FROM node:24-alpine AS builder
# Don't forget to edit the .dockerignore if needed
COPY . /app
WORKDIR /app
RUN npm install && npm run build:ts;
FROM node:24-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json .
RUN npm ci --omit=dev;
# Start the app
CMD ["node", "dist/run.js"]

View file

@ -1,6 +1,6 @@
{
"type": "module",
"name": "user-icons",
"name": "icons-service",
"version": "1.0.0",
"description": "This project was bootstrapped with Fastify-CLI.",
"main": "app.ts",

View file

@ -0,0 +1,16 @@
// this sould only be used by the docker file !
import fastify, { FastifyInstance } from "fastify";
import app from './app.js'
const start = async () => {
const f: FastifyInstance = fastify({logger: true});
try {
await f.register(app, {});
await f.listen({ port: 80, host: '0.0.0.0' })
} catch (err) {
f.log.error(err)
process.exit(1)
}
}
start()