NextDrought commited on
Commit
b4bdca9
1 Parent(s): 67c53a6

Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -0
Dockerfile CHANGED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-alpine AS builder
2
+ RUN apk add --no-cache libc6-compat
3
+ WORKDIR /app
4
+
5
+ # Install dependencies based on the preferred package manager
6
+ COPY frontend .
7
+ RUN \
8
+ if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
9
+ elif [ -f package-lock.json ]; then npm ci; \
10
+ elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
11
+ else echo "Lockfile not found." && exit 1; \
12
+ fi
13
+
14
+ RUN npm run build
15
+ FROM python:3.10-slim AS backend
16
+ WORKDIR /app
17
+
18
+ RUN apt-get update && apt-get install --no-install-recommends -y \
19
+ git ffmpeg curl gnupg \
20
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
21
+
22
+ RUN useradd -m -u 1000 user
23
+
24
+ COPY ./requirements.txt .
25
+ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
26
+
27
+ USER user
28
+ ENV HOME=/home/user \
29
+ PATH=/home/user/.local/bin:$PATH
30
+
31
+
32
+ WORKDIR $HOME/app
33
+ COPY --from=builder /app/build ./static
34
+ COPY . .
35
+
36
+ CMD ["python", "app.py"]
37
+
38
+