-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (34 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
51 lines (34 loc) · 1.13 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
# Stage 1: Build frontend
FROM node:18-alpine AS frontend-build
WORKDIR /app/frontend
COPY client/package*.json ./
RUN npm install
COPY client/ ./
ARG REACT_APP_API_URL=
ENV REACT_APP_API_URL=${REACT_APP_API_URL}
RUN npm run build
# Stage 2: Final image with both backend and frontend
FROM python:3.11-slim
# Install nginx and supervisor
RUN apt-get update && \
apt-get install -y nginx supervisor curl && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy and install backend dependencies
COPY backend/requirements.txt ./backend/
RUN pip install --no-cache-dir -r backend/requirements.txt
# Copy backend code
COPY backend/ ./backend/
# Copy built frontend from build stage
COPY --from=frontend-build /app/frontend/build /var/www/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -f /etc/nginx/sites-enabled/default
# Copy supervisor configuration
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Create necessary directories
RUN mkdir -p /var/log/supervisor
# Expose ports
EXPOSE 80 8000
# Start supervisor
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]