Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +40 -0
Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Gunakan image Playwright sebagai base
|
| 2 |
+
FROM mcr.microsoft.com/playwright:focal
|
| 3 |
+
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD 1
|
| 4 |
+
|
| 5 |
+
# Install Python 3.9 dan pip
|
| 6 |
+
RUN apt-get update && \
|
| 7 |
+
apt-get upgrade -y && \
|
| 8 |
+
apt-get install -y software-properties-common && \
|
| 9 |
+
add-apt-repository ppa:deadsnakes/ppa && \
|
| 10 |
+
apt-get update && \
|
| 11 |
+
apt-get install -y python3.9 python3.9-venv python3.9-dev python3-pip && \
|
| 12 |
+
rm -rf /var/lib/apt/lists/* && \
|
| 13 |
+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
|
| 14 |
+
|
| 15 |
+
# Set Timezone
|
| 16 |
+
ENV TZ=Asia/Jakarta
|
| 17 |
+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
| 18 |
+
|
| 19 |
+
# Set Workdir
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
|
| 22 |
+
# Copy semua file proyek
|
| 23 |
+
COPY . .
|
| 24 |
+
|
| 25 |
+
# Set permission agar Playwright dapat berjalan dengan benar
|
| 26 |
+
RUN chmod -R 777 /app
|
| 27 |
+
|
| 28 |
+
# Install dependencies Python
|
| 29 |
+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
| 30 |
+
|
| 31 |
+
# Install dependencies Node.js untuk Playwright
|
| 32 |
+
RUN npm cache clean --force && \
|
| 33 |
+
npm install --force && \
|
| 34 |
+
npx playwright install chromium --with-deps
|
| 35 |
+
|
| 36 |
+
# Expose port API
|
| 37 |
+
EXPOSE 7860
|
| 38 |
+
|
| 39 |
+
# Jalankan FastAPI
|
| 40 |
+
CMD ["npm start"]
|