File size: 1,799 Bytes
7d12d67
 
 
 
 
2836cac
 
 
7d12d67
 
 
 
 
 
 
 
 
0dd6ac1
 
7d12d67
0ac3e21
 
7d12d67
0ef5fd9
ab0ec2a
5872346
8e79961
 
 
 
 
 
 
 
 
 
 
 
eae3286
 
4f3e1bc
1ab8a9b
e4877fb
 
 
 
 
 
 
f37aec2
ba93af8
0dd6ac1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9cce774
0dd6ac1
 
 
4b55a9d
0dd6ac1
 
 
 
 
 
eae3286
 
 
 
 
2aa441c
 
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile

FROM python:3.12

RUN --mount=type=secret,id=GOOGLE_API_KEY,mode=0444,required=true
RUN --mount=type=secret,id=ALLOWED_ORIGINS,mode=0444,required=true
RUN --mount=type=secret,id=NEXT_PUBLIC_BACKEND_URL,mode=0444,required=true

RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /app

RUN pip install uv
COPY --chown=user . /app

# ---------- Backend ----------
WORKDIR /app/backend
RUN uv sync
RUN uv run playwright install chromium

USER root
RUN apt update
RUN apt install -y libnss3\
 libnspr4\
 libdbus-1-3\
 libatk1.0-0\
 libatk-bridge2.0-0\
 libcups2\
 libxcomposite1\
 libxdamage1\
 libxfixes3\
 libxrandr2\
 libgbm1\
 libxkbcommon0\
 libasound2\
 libatspi2.0-0\
 nginx
RUN mkdir -p /var/lib/nginx/body && chown -R user:user /var/lib/nginx
RUN mkdir -p /var/log/nginx && chown -R user:user /var/log/nginx
RUN apt-get update && apt-get install -y \
    curl \
    unzip \
    bash \
    build-essential \
    netcat-traditional \
    && rm -rf /var/lib/apt/lists/*
USER user

# ---------- Frontend ----------
WORKDIR /app/frontend

# Install system dependencies
USER root
RUN apt-get update && apt-get install -y \
    curl \
    unzip \
    bash \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Install Node.js (LTS)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs
USER user

# Install Bun
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/home/user/.bun/bin:${PATH}"

RUN bun install
RUN bun run build

WORKDIR /app

# ---------- Nginx ----------
USER root
COPY nginx.conf /etc/nginx/nginx.conf
USER user

RUN chmod +x /app/start.sh
CMD ["/app/start.sh"]