Spaces:
Paused
Paused
Create Dockerfile
Browse files- Dockerfile +98 -0
Dockerfile
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# base image with playwright and necessary libraries
|
| 2 |
+
FROM mcr.microsoft.com/playwright:focal
|
| 3 |
+
|
| 4 |
+
# environment variables
|
| 5 |
+
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \
|
| 6 |
+
CHROME_BIN=/usr/bin/chromium \
|
| 7 |
+
TZ=Asia/Jakarta \
|
| 8 |
+
DEBIAN_FRONTEND=noninteractive \
|
| 9 |
+
PORT=3000 \
|
| 10 |
+
MADE=PAXSENIXAPI
|
| 11 |
+
|
| 12 |
+
# install dependencies
|
| 13 |
+
RUN apt-get update && \
|
| 14 |
+
apt-get install -y \
|
| 15 |
+
software-properties-common \
|
| 16 |
+
# chromium \
|
| 17 |
+
ffmpeg \
|
| 18 |
+
imagemagick \
|
| 19 |
+
libnss3-dev \
|
| 20 |
+
webp \
|
| 21 |
+
gconf-service \
|
| 22 |
+
libasound2 \
|
| 23 |
+
libatk1.0-0 \
|
| 24 |
+
libc6 \
|
| 25 |
+
libcairo2 \
|
| 26 |
+
libcups2 \
|
| 27 |
+
libdbus-1-3 \
|
| 28 |
+
libexpat1 \
|
| 29 |
+
libfontconfig1 \
|
| 30 |
+
libgcc1 \
|
| 31 |
+
libgconf-2-4 \
|
| 32 |
+
libgdk-pixbuf2.0-0 \
|
| 33 |
+
libglib2.0-0 \
|
| 34 |
+
libgtk-3-0 \
|
| 35 |
+
libnspr4 \
|
| 36 |
+
libpango-1.0-0 \
|
| 37 |
+
libpangocairo-1.0-0 \
|
| 38 |
+
libstdc++6 \
|
| 39 |
+
libx11-6 \
|
| 40 |
+
libx11-xcb1 \
|
| 41 |
+
libxcb1 \
|
| 42 |
+
libxcomposite1 \
|
| 43 |
+
libxcursor1 \
|
| 44 |
+
libxdamage1 \
|
| 45 |
+
libxext6 \
|
| 46 |
+
libxfixes3 \
|
| 47 |
+
libxi6 \
|
| 48 |
+
libxrandr2 \
|
| 49 |
+
libxrender1 \
|
| 50 |
+
libxss1 \
|
| 51 |
+
libxtst6 \
|
| 52 |
+
ca-certificates \
|
| 53 |
+
libappindicator1 \
|
| 54 |
+
lsb-release \
|
| 55 |
+
xdg-utils \
|
| 56 |
+
fonts-liberation \
|
| 57 |
+
fonts-dejavu \
|
| 58 |
+
fonts-noto-color-emoji \
|
| 59 |
+
python3.9 \
|
| 60 |
+
python3.9-venv \
|
| 61 |
+
python3.9-dev \
|
| 62 |
+
build-essential \
|
| 63 |
+
python3-pip && \
|
| 64 |
+
rm -rf /var/lib/apt/lists/* && \
|
| 65 |
+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
|
| 66 |
+
|
| 67 |
+
# set timezone
|
| 68 |
+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
| 69 |
+
|
| 70 |
+
# set working directory
|
| 71 |
+
WORKDIR /app
|
| 72 |
+
|
| 73 |
+
# clone private repo using a secret
|
| 74 |
+
RUN --mount=type=secret,id=GITHUB_REPO,required=true \
|
| 75 |
+
git clone $(cat /run/secrets/GITHUB_REPO) PAXSENIXAPI-SERVER
|
| 76 |
+
|
| 77 |
+
# set working directory to cloned repo
|
| 78 |
+
WORKDIR /app/PAXSENIXAPI-SERVER
|
| 79 |
+
|
| 80 |
+
# install dependencies
|
| 81 |
+
RUN chmod -R 777 /app && \
|
| 82 |
+
npm cache clean --force && \
|
| 83 |
+
npm install --force && \
|
| 84 |
+
npx playwright install --with-deps
|
| 85 |
+
|
| 86 |
+
# install python dependencies (if any)
|
| 87 |
+
COPY requirements.txt .
|
| 88 |
+
RUN python3 -m venv venv && \
|
| 89 |
+
. venv/bin/activate && \
|
| 90 |
+
pip install --no-cache-dir -r requirements.txt
|
| 91 |
+
|
| 92 |
+
ENV PATH="/app/PAXSENIXAPI-SERVER/venv/bin:$PATH"
|
| 93 |
+
|
| 94 |
+
# expose port
|
| 95 |
+
EXPOSE 3000
|
| 96 |
+
|
| 97 |
+
# start the application
|
| 98 |
+
CMD ["python3", "main.py"]
|