File size: 867 Bytes
5bb150a
 
 
 
 
 
 
 
 
 
 
 
cd604f5
16ae86b
 
 
5bb150a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM node:16-alpine as build-frontend

# Set the working directory
WORKDIR /app

# Copy package files and install dependencies
COPY frontend/package*.json /app/frontend/
RUN npm install --prefix frontend/
RUN npm ci --prefix frontend/

# Copy the rest of the application files
COPY frontend/ /app/frontend/

RUN --mount=type=secret,id=PUBLIC_BACKEND_WS_URL,mode=0444,required=true \
  echo "A=$(cat /run/secrets/PUBLIC_BACKEND_WS_URL)" > frontend/.env
 
RUN npm run build --prefix frontend/

# Start a new stage using python:3.9-alpine
FROM python:3.9-alpine

# Copy the built front-end files
COPY --from=build-frontend /app/frontend/build /app/build

COPY /backend /app

# Install uvicorn
RUN pip install uvicorn fastapi

# Set the working directory
WORKDIR /app

# Run the uvicorn server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
EXPOSE 8000