-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (56 loc) · 1.75 KB
/
Copy pathDockerfile
File metadata and controls
71 lines (56 loc) · 1.75 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
# Stage 1: Build JS assets
FROM node:20-slim AS js-builder
WORKDIR /frontend
COPY frontend/package.json .
# Copy each submodule's package.json first for better layer caching
COPY frontend/app/package.json ./app/
COPY frontend/region_picker/package.json ./region_picker/
COPY frontend/record_suggestion/package.json ./record_suggestion/
COPY frontend/admin/package.json ./admin/
RUN npm run install
# Now copy all source files and build
COPY frontend/ .
RUN npm run build
# Stage 2: Build Python/Django image
# Use Python 3.11 slim image as base
FROM python:3.11-slim-bookworm
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
make \
libpq-dev \
postgresql-client \
gdal-bin \
libgdal-dev \
libproj-dev \
proj-bin \
binutils \
libspatialindex-dev \
git \
&& rm -rf /var/lib/apt/lists/*
# Set work directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt /app/
RUN pip install --upgrade pip && \
pip install -r requirements.txt
# Copy only the compiled dist output from the JS builder
# Store in a separate location so entrypoint.sh can sync it after the project COPY
COPY --from=js-builder /frontend/dist/ /opt/bluepages-js-dist/
# Copy the rest of the project (no node_modules, no JS source)
COPY . /app/
# Make entrypoint script executable
RUN chmod +x /app/entrypoint.sh
# Create necessary directories
RUN mkdir -p /app/bluepages/static_root /app/bluepages/media_root
# Set working directory to Django project
WORKDIR /app/bluepages
# Expose port
EXPOSE 8000
# Use entrypoint script
ENTRYPOINT ["/app/entrypoint.sh"]