-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
46 lines (34 loc) · 1.04 KB
/
Dockerfile
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
# Stage 1: Build the React app
FROM node:23-slim as build
# Set the working directory
WORKDIR /usr/src/app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install Node.js dependencies
RUN npm ci
# Copy the rest of the application
COPY . .
# Build the React app
RUN npm run build
# Stage 2: Run the FastAPI app
FROM python:3.12.2-slim
# Set the working directory
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y \
gcc \
build-essential \
tesseract-ocr \
&& rm -rf /var/lib/apt/lists/*
# Copy the build output and Python server files
COPY --from=build /usr/src/app/build ./build
COPY --from=build /usr/src/app/CHANGELOG.md ./CHANGELOG.md
COPY server/ ./server
RUN mkdir -p /usr/src/app/data
RUN mkdir -p /usr/src/app/static
RUN mkdir -p /usr/src/app/temp
# Install Python dependencies
RUN pip install --no-cache-dir -r /usr/src/app/server/requirements.txt
# Expose necessary ports
EXPOSE 5000
# Define the command to run the FastAPI app
CMD ["uvicorn", "server.server:app", "--host", "0.0.0.0", "--port", "5000"]