-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.Dockerfile
More file actions
58 lines (45 loc) · 1.64 KB
/
dev.Dockerfile
File metadata and controls
58 lines (45 loc) · 1.64 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
# ===============================
# Builder stage – preload database
# ===============================
FROM postgres:16.4 AS builder
ENV POSTGRES_USER=postgres
ENV POSTGRES_PASSWORD=root
ENV POSTGRES_DB=postgres
ENV PGDATA=/var/lib/postgresql/data
# Install Node.js and Python
RUN apt-get update && apt-get install -y --no-install-recommends \
curl postgresql-client python3 python3-pip python3-venv \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& node -v && npm -v \
&& python3 -m venv /opt/venv \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/opt/venv/bin:$PATH"
# Copy requirements and install
COPY requirements/build.in /tmp/requirements.in
RUN pip install --no-cache-dir -r /tmp/requirements.in
# Copy app code and CSVs
WORKDIR /app
COPY schema ./schema
COPY scripts ./scripts
COPY scripts/setup-db.sh /app/setup-db.sh
COPY final.csv leaders.csv fichier_combine_updated_big_fixed.csv ./
# Install dependencies
RUN npm install -g --no-fund pnpm@10.10.0
WORKDIR /app/schema
RUN pnpm install --frozen-lockfile
WORKDIR /app
# Make ./data writable by postgres user
RUN mkdir -p /app/data && chown -R postgres:postgres /app/data
RUN chown -R postgres:postgres /app/schema/
# Start Postgres for migrations and CSV loading
USER postgres
RUN /app/setup-db.sh
# ===============================
# Final image – production-ready
# ===============================
FROM postgres:16.4
USER root
RUN mkdir -p /var/lib/postgresql/data && chown -R postgres:postgres /var/lib/postgresql
COPY --from=builder --chown=postgres:postgres /var/lib/postgresql/data /var/lib/postgresql/data
USER postgres