Spaces:
Sleeping
Sleeping
khulnasoft
commited on
Commit
•
499c4eb
1
Parent(s):
9e03cbd
Create Dockerfile
Browse files- Dockerfile +36 -0
Dockerfile
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|