-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (50 loc) · 1.92 KB
/
Dockerfile
File metadata and controls
66 lines (50 loc) · 1.92 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
# Multi-stage build: Start with Python 3.12 base
FROM python:3.12-bookworm AS python-base
# Use the official Node image so npm is always available during frontend builds
FROM node:22-bookworm AS node-base
# Main stage: Use FalkorDB base and copy Python 3.12
FROM falkordb/falkordb:latest
ENV PYTHONUNBUFFERED=1 \
FALKORDB_HOST=localhost \
FALKORDB_PORT=6379
USER root
# Copy Python 3.12 from the python base image
COPY --from=python-base /usr/local /usr/local
# Copy Node.js tooling from the official Node image
COPY --from=node-base /usr/local/bin/node /usr/local/bin/node
COPY --from=node-base /usr/local/lib/node_modules /usr/local/lib/node_modules
# Install netcat for wait loop in start.sh and system build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
netcat-openbsd \
git \
build-essential \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python3 \
&& ln -sf /usr/local/bin/python3.12 /usr/bin/python \
&& ln -sf ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -sf ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
WORKDIR /app
# Install Python dependencies
COPY pyproject.toml ./
RUN pip install --no-cache-dir --break-system-packages .
# Verify Node.js tooling for building the frontend
RUN node --version && npm --version
# Copy frontend package files and install dependencies
COPY app/package*.json ./app/
RUN if [ -f ./app/package-lock.json ]; then \
npm --prefix ./app ci --no-audit --no-fund; \
elif [ -f ./app/package.json ]; then \
npm --prefix ./app install --no-audit --no-fund; \
fi
# Copy frontend source and build
COPY ./app ./app
RUN npm --prefix ./app run build
# Copy backend code
COPY ./api ./api
# Copy and make start.sh executable
COPY start.sh /start.sh
RUN chmod +x /start.sh
EXPOSE 5000 6379
# Use start.sh as entrypoint
ENTRYPOINT ["/start.sh"]