-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.builder
More file actions
119 lines (92 loc) · 2.55 KB
/
Dockerfile.builder
File metadata and controls
119 lines (92 loc) · 2.55 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Multi-purpose builder image for HyperCode project
# This image can be used for builds, tests, and CI/CD pipelines
ARG NODE_IMAGE=node:20.18.1-bookworm-slim
FROM ${NODE_IMAGE} as node
FROM python:3.11-slim-bookworm as base
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
build-essential \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js without curl|bash (copy from official node image)
# Supply-chain note: pin NODE_IMAGE (ideally with a digest) in CI/build args for reproducibility.
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/bin/npm /usr/local/bin/npm
COPY --from=node /usr/local/bin/npx /usr/local/bin/npx
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
# Install common Python tools
RUN pip install --no-cache-dir \
pip-tools \
wheel \
setuptools \
twine
WORKDIR /workspace
# ==================== Development Stage ====================
FROM base as development
# Install development tools
RUN pip install --no-cache-dir \
pytest \
pytest-cov \
pytest-asyncio \
pytest-mock \
black \
ruff \
mypy \
ipython \
debugpy \
pre-commit
CMD ["/bin/bash"]
# ==================== Testing Stage ====================
FROM development as testing
# Install additional test dependencies
RUN pip install --no-cache-dir \
faker \
factory-boy \
hypothesis \
responses \
freezegun \
pytest-xdist \
pytest-timeout
# Install performance testing tools
RUN npm install -g artillery
WORKDIR /tests
CMD ["pytest", "-v"]
# ==================== CI Stage ====================
FROM development as ci
# Install CI/CD specific tools
RUN pip install --no-cache-dir \
coverage[toml] \
pytest-html \
pytest-json-report \
bandit \
safety
# Install code quality tools
RUN npm install -g \
eslint \
prettier \
@commitlint/cli
WORKDIR /ci
CMD ["/bin/bash"]
# ==================== Documentation Builder ====================
FROM base as docs
# Install documentation tools
RUN pip install --no-cache-dir \
mkdocs \
mkdocs-material \
mkdocstrings[python] \
mkdocs-gen-files \
mkdocs-literate-nav \
mkdocs-section-index
WORKDIR /docs
CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]
# ==================== Database Migration ====================
FROM base as migration
# Install Prisma and migration tools
RUN pip install --no-cache-dir \
prisma \
alembic \
sqlalchemy
WORKDIR /migrations
CMD ["prisma", "migrate", "deploy"]