From 96085572221de264225f4e218c599b6ae7e36af5 Mon Sep 17 00:00:00 2001 From: Joshua Amaju Date: Sun, 24 Mar 2024 15:18:07 +0100 Subject: [PATCH] chore: add template docker file --- templates/basic/Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 templates/basic/Dockerfile diff --git a/templates/basic/Dockerfile b/templates/basic/Dockerfile new file mode 100644 index 0000000..b4ed389 --- /dev/null +++ b/templates/basic/Dockerfile @@ -0,0 +1,26 @@ +FROM node:20-alpine AS base + +FROM base AS builder + +RUN apk add --no-cache libc6-compat +WORKDIR /app + +COPY package*json tsconfig.json src ./ + +RUN npm ci && \ + npm run build && \ + npm prune --production + +FROM base AS runner +WORKDIR /app + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 hono + +COPY --from=builder --chown=hono:nodejs /app/node_modules /app/node_modules +COPY --from=builder --chown=hono:nodejs /app/dist /app/dist + +USER hono +EXPOSE 3000 + +CMD ["node", "server.js"] \ No newline at end of file