File tree Expand file tree Collapse file tree 9 files changed +2552
-736
lines changed
Expand file tree Collapse file tree 9 files changed +2552
-736
lines changed Original file line number Diff line number Diff line change 1+ # Exclude development and VCS files from the Docker build context
2+ .git
3+ .gitignore
4+
5+ # Local environment files and secrets
6+ .env
7+ .env. *
8+
9+ # Node artifacts
10+ node_modules
11+ npm-debug.log *
12+
13+ # Build outputs (we build inside the image)
14+ dist
15+ var
16+
17+ # Editor/OS files
18+ .DS_Store
19+ * .swp
20+ * ~
Original file line number Diff line number Diff line change @@ -38,3 +38,5 @@ coverage/
3838# Misc
3939.turbo /
4040.vercel /
41+
42+ src /public /output.css
Original file line number Diff line number Diff line change 1+ # syntax=docker/dockerfile:1.7
2+
3+ # ---- Base image ----
4+ ARG NODE_VERSION=24
5+ FROM node:${NODE_VERSION}-alpine AS base
6+ WORKDIR /app
7+ ENV CI=true
8+
9+ # ---- Install full deps for building ----
10+ FROM base AS deps
11+ COPY package*.json ./
12+ RUN npm install
13+
14+ # ---- Build application (tsc + tailwind) ----
15+ FROM deps AS build
16+ COPY tsconfig.json ./
17+ COPY postcss.config.js ./
18+ COPY src ./src
19+ # Build JS and CSS
20+ RUN npm run build
21+ # Copy static assets and views into the dist folder expected at runtime
22+ RUN mkdir -p dist/public dist/views \
23+ && cp -r src/public/* dist/public/ \
24+ && cp -r src/views/* dist/views/
25+
26+ # ---- Production-only dependencies ----
27+ FROM base AS prod-deps
28+ COPY package*.json ./
29+ RUN npm ci --omit=dev
30+
31+ # ---- Runtime image ----
32+ FROM node:${NODE_VERSION}-alpine AS runner
33+ WORKDIR /app
34+ ENV NODE_ENV=production
35+ ENV PORT=3333
36+
37+ # Run as non-root user for security
38+ USER node
39+
40+ # Copy only the needed runtime artifacts
41+ COPY --chown=node:node --from=prod-deps /app/node_modules ./node_modules
42+ COPY --chown=node:node package*.json ./
43+ COPY --chown=node:node --from=build /app/dist ./dist
44+
45+ EXPOSE 3333
46+ # Simple healthcheck hitting the root page
47+ HEALTHCHECK --interval=30s --timeout=3s --start-period=20s --retries=3 CMD wget -q -O - http://127.0.0.1:${PORT}/ || exit 1
48+
49+ CMD ["node" , "dist/main.js" ]
Original file line number Diff line number Diff line change 1+ target "www" {
2+ context = " ."
3+ dockerfile = " Dockerfile"
4+ platforms = [" linux/amd64" , " linux/arm64" ]
5+ tags = [
6+ " ghcr.io/tigrisdata-community/pastebin:latest" ,
7+ ]
8+ push = true
9+ }
10+
11+ group "default" {
12+ targets = [" www" ]
13+ }
You can’t perform that action at this time.
0 commit comments