File size: 957 Bytes
de234b1
 
 
 
 
 
e54b26e
de234b1
 
 
e54b26e
de234b1
e54b26e
 
 
de234b1
e54b26e
de234b1
 
 
e54b26e
de234b1
 
 
 
 
 
e54b26e
de234b1
 
 
 
44b1434
de234b1
44b1434
e54b26e
de234b1
 
b978eed
 
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
#------------------------
# STAGE 1: Backend build
#------------------------
FROM python:3.9-slim-buster as backend
WORKDIR /app/backend

# Copy necessary files
COPY requirements.txt .
COPY build_scripts/build.sh .

# Set environment variable, make the script executable and run it
ENV STAGE=backend
RUN chmod +x ./build.sh && \
    ./build.sh backend && \
    rm -rf /var/lib/apt/lists/*

# Copy the rest of the backend app
COPY web_app/backend/ .

CMD ["python", "run.py"]

#-------------------------
# STAGE 2: Frontend build
#-------------------------
FROM node:14-alpine as frontend
WORKDIR /app/frontend

# Grouped copy for package-related files and the frontend app
COPY web_app/frontend/package*.json .
COPY web_app/frontend/ .
COPY build_scripts/build.sh .

# Set environment variables, make the script executable and run it
ENV STAGE=frontend

RUN chmod +x ./build.sh && ./build.sh frontend

EXPOSE 3000
CMD ["serve", "-s", "dist", "-l", "3000"]