-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (45 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
57 lines (45 loc) · 1.26 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
# Build stage for client
FROM node:20 AS client-builder
WORKDIR /app/client
COPY client/package*.json ./
RUN npm install
COPY client/ .
RUN npm run build
# Build stage for server
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libxml-xpath-perl \
pdfgrep \
nodejs \
npm \
iproute2 \
&& rm -rf /var/lib/apt/lists/*
# Install serve globally
RUN npm install -g serve
# Create a non-root user
RUN useradd -m appuser
# Create necessary directories
RUN mkdir -p /app/exploit_seek_data/cache \
/app/exploit_seek_data/databases \
/app/exploit_seek_data/logs \
/app/exploit_seek_data/reports \
/app/exploit_seek_data/uploads
# Copy server files
COPY server/ /app/
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install gunicorn gevent
# Copy built client files from client-builder stage
COPY --from=client-builder /app/client/dist /app/client/dist
# Copy and setup start script
COPY start.sh /app/
RUN sed -i 's/\r$//' /app/start.sh && \
chmod +x /app/start.sh
# Change ownership of all directories to appuser
RUN chown -R appuser:appuser /app /home/appuser
# Switch to the non-root user
USER appuser
# Expose ports for both services
EXPOSE 5000 8080
CMD ["/app/start.sh"]