URL Shrinker: acortador de URLs con Node 24 + node:sqlite

App sin dependencias: UI web, POST /api/shorten (codigo aleatorio o
personalizado), redireccion 302 con contador de clics, /api/stats/<code>
y /healthz. SQLite en DATA_DIR (/data) para montar volumen persistente.
This commit is contained in:
Fable
2026-09-12 03:38:39 +02:00
commit 309661c9e4
5 changed files with 355 additions and 0 deletions

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM node:24-alpine
WORKDIR /app
COPY server.js index.html ./
ENV NODE_ENV=production \
PORT=3000 \
DATA_DIR=/data
RUN mkdir -p /data && chown node:node /data /app
USER node
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
CMD wget -qO- http://127.0.0.1:3000/healthz || exit 1
CMD ["node", "server.js"]