-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (36 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
55 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# syntax=docker/dockerfile:1
# Repix - Image transformation service with Sharp
# Optimized for Docker distribution with multi-platform support (linux/amd64, linux/arm64)
# Version is set at build time via --build-arg VERSION
# Build stage
FROM node:22-alpine3.19 AS builder
# Install build dependencies (minimal - Sharp uses prebuilt binaries, but tsc/vite need deps)
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Copy dependency files
COPY package*.json ./
COPY tsconfig.json ./
COPY vite.config.ts ./
# Install dependencies (use npm ci for reproducible builds)
RUN npm ci --include=dev
# Copy source
COPY src/ ./src/
# Build application
RUN npm run build
FROM node:22-alpine3.19 AS production
ARG VERSION=dev
LABEL org.opencontainers.image.version=$VERSION
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev \
&& npm cache clean --force
RUN addgroup -g 1001 -S nodejs \
&& adduser -S repix -u 1001 -G nodejs
COPY --from=builder --chown=repix:nodejs /app/dist ./dist
USER repix
EXPOSE 3210
# Use PORT env (Railway injects 8080; Render/local use 3210)
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD sh -c 'wget -q -O /dev/null "http://localhost:${PORT:-3210}/health" || exit 1'
CMD ["node", "dist/index.js"]