Skip to content

Commit 8c01f20

Browse files
added docker file to host server
1 parent a613958 commit 8c01f20

6 files changed

Lines changed: 91 additions & 130 deletions

File tree

Dockerfile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Android builds currently work well with JDK 17 for modern AGP
2+
FROM eclipse-temurin:17-jdk-jammy
3+
4+
ARG ANDROID_SDK_ROOT=/opt/android-sdk
5+
ENV ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}
6+
ENV ANDROID_HOME=${ANDROID_SDK_ROOT}
7+
ENV PATH=${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/build-tools/34.0.0
8+
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
wget unzip git ca-certificates \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# Install Android SDK command line tools
14+
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools \
15+
&& wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/cmdline-tools.zip \
16+
&& unzip -q /tmp/cmdline-tools.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools \
17+
&& mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest \
18+
&& rm /tmp/cmdline-tools.zip
19+
20+
# Accept licenses + install required SDK packages (adjust as needed)
21+
RUN yes | sdkmanager --licenses
22+
RUN sdkmanager \
23+
"platform-tools" \
24+
"platforms;android-34" \
25+
"build-tools;34.0.0"
26+
27+
# ---- Install Node.js 24.x (NodeSource) ----
28+
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
29+
&& apt-get update \
30+
&& apt-get install -y --no-install-recommends nodejs \
31+
&& rm -rf /var/lib/apt/lists/*
32+
33+
# Install Chrome dependencies for Puppeteer
34+
RUN apt-get update && apt-get install -y \
35+
git \
36+
wget \
37+
gnupg \
38+
ca-certificates \
39+
fonts-liberation \
40+
libasound2 \
41+
libatk-bridge2.0-0 \
42+
libatk1.0-0 \
43+
libcups2 \
44+
libdbus-1-3 \
45+
libdrm2 \
46+
libgbm1 \
47+
libgtk-3-0 \
48+
libnspr4 \
49+
libnss3 \
50+
libx11-xcb1 \
51+
libxcomposite1 \
52+
libxdamage1 \
53+
libxrandr2 \
54+
xdg-utils \
55+
&& rm -rf /var/lib/apt/lists/*
56+
57+
# Install prod deps
58+
COPY package.json package-lock.json* ./
59+
RUN npm ci --omit=dev
60+
61+
# Install Puppeteer's Chrome explicitly
62+
RUN npx puppeteer browsers install chrome
63+
64+
# Find and set the Chrome executable path
65+
RUN CHROME_PATH=$(find /root/.cache/puppeteer -name chrome -type f | head -n 1) && \
66+
echo "export PUPPETEER_EXECUTABLE_PATH=$CHROME_PATH" >> /etc/profile.d/puppeteer.sh && \
67+
echo "Chrome installed at: $CHROME_PATH" && \
68+
chmod +x /etc/profile.d/puppeteer.sh
69+
70+
COPY dist/ liascript-exporter/
71+
72+
EXPOSE 4000
73+
74+
# Create entrypoint script that sources the environment
75+
RUN echo '#!/bin/sh\n\
76+
export PUPPETEER_EXECUTABLE_PATH=$(find /root/.cache/puppeteer -name chrome -type f | head -n 1)\n\
77+
exec node liascript-exporter/index.js "$@"' > /entrypoint.sh && \
78+
chmod +x /entrypoint.sh
79+
80+
ENTRYPOINT ["/entrypoint.sh"]
81+
CMD ["serve", "--port", "4000"]

0 commit comments

Comments
 (0)