-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (29 loc) · 1018 Bytes
/
Dockerfile
File metadata and controls
33 lines (29 loc) · 1018 Bytes
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
# syntax=docker/dockerfile:1
# Base stage
FROM node:22-slim AS base
ENV NODE_ENV=production
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Deps stage
FROM base AS deps
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ && rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json* ./
RUN npm ci --include=dev
# Development stage
FROM base AS dev
ENV NODE_ENV=development
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN git config --global user.email "dev@git-cms.local" \
&& git config --global user.name "Git CMS Dev" \
&& git config --global init.defaultBranch main
CMD ["npm", "run", "serve"]
# Test stage
FROM base AS test
ENV NODE_ENV=test
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN git config --global user.email "bot@git-cms.local" \
&& git config --global user.name "Git CMS Bot" \
&& git config --global init.defaultBranch main
CMD ["npm", "run", "test:local"]