-
Notifications
You must be signed in to change notification settings - Fork 189
/
Dockerfile
70 lines (55 loc) · 2.49 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Use the official Node.js 14 Debian-based image as the base image
FROM node:14-bullseye-slim
# Set the working directory
WORKDIR /kaguya
# Copy package.json and package-lock.json
COPY package*.json ./
# Install Node.js dependencies
RUN npm install
# Install Python, Git, Curl, and build dependencies
RUN apt-get update && \
apt-get install -y python3 python3-pip git curl build-essential gfortran && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && \
apt-get install -y ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install numpy pandas python-dotenv yfinance moviepy PyYAML selenium beautifulsoup4 requests html2text tiktoken
# Install Firefox and GeckoDriver (WebDriver for Firefox)
RUN apt-get update && \
apt-get install -y firefox-esr wget && \
wget -q https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz -O /tmp/geckodriver.tar.gz && \
tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin && \
rm /tmp/geckodriver.tar.gz && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3 /usr/bin/python
# Install Chrome and ChromeDriver (WebDriver for Chrome)
RUN apt-get update && \
apt-get install -y wget unzip && \
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
dpkg -i google-chrome-stable_current_amd64.deb || apt-get install -yf && \
rm google-chrome-stable_current_amd64.deb && \
wget -q https://chromedriver.storage.googleapis.com/$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
unzip chromedriver_linux64.zip -d /usr/local/bin && \
rm chromedriver_linux64.zip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user named 'appuser' and set ownership of the /kaguya directory
RUN useradd -m appuser && chown -R appuser /kaguya
# Switch to the 'appuser' user
USER appuser
# Set Git identity
ARG GIT_NAME
ARG GIT_EMAIL
RUN git config --global user.name "$GIT_NAME"
RUN git config --global user.email "$GIT_EMAIL"
# Add an exception for the /app directory to resolve Git ownership issues
RUN git config --global --add safe.directory /kaguya
# Ensure the ownership of the Git repository is set to 'appuser' if the .git directory exists
RUN if [ -d "/kaguya/.git" ]; then chown -R appuser /kaguya/.git; fi
# Expose the port that the application will run on
EXPOSE 3000
# Start the application
CMD ["npm", "run", "dev"]