this should work
Browse files- App/Worker.py +14 -3
- Dockerfile +13 -2
App/Worker.py
CHANGED
@@ -23,8 +23,15 @@ def worker_process_init_handler(**kwargs):
|
|
23 |
bot.start()
|
24 |
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
|
30 |
def download_with_wget(link, download_dir, filename):
|
@@ -35,6 +42,10 @@ def download_with_wget(link, download_dir, filename):
|
|
35 |
def copy_remotion_app(src: str, dest: str):
|
36 |
shutil.copytree(src, dest)
|
37 |
|
|
|
|
|
|
|
|
|
38 |
|
39 |
@celery.task
|
40 |
def install_dependencies(directory: str):
|
@@ -89,7 +100,7 @@ def celery_task(links, script=""):
|
|
89 |
|
90 |
chain(
|
91 |
copy_remotion_app.si(remotion_app_dir, temp_dir),
|
92 |
-
install_dependencies.si(temp_dir),
|
93 |
download_assets.si(links, temp_dir) if links else None,
|
94 |
render_video.si(temp_dir, output_dir),
|
95 |
cleanup_temp_directory.si(temp_dir, output_dir),
|
|
|
23 |
bot.start()
|
24 |
|
25 |
|
26 |
+
def create_symlink(source_dir, target_dir, symlink_name):
|
27 |
+
source_path = os.path.join(source_dir, symlink_name)
|
28 |
+
target_path = os.path.join(target_dir, symlink_name)
|
29 |
+
|
30 |
+
try:
|
31 |
+
os.symlink(source_path, target_path)
|
32 |
+
print(f"Symlink '{symlink_name}' created successfully.")
|
33 |
+
except FileExistsError:
|
34 |
+
print(f"Symlink '{symlink_name}' already exists.")
|
35 |
|
36 |
|
37 |
def download_with_wget(link, download_dir, filename):
|
|
|
42 |
def copy_remotion_app(src: str, dest: str):
|
43 |
shutil.copytree(src, dest)
|
44 |
|
45 |
+
# # create symbolic link to prevent multiple installs
|
46 |
+
# source_dir = os.path.join(src, "node_module")
|
47 |
+
# create_symlink(source_dir, target_dir=dest, symlink_name="node_module")
|
48 |
+
|
49 |
|
50 |
@celery.task
|
51 |
def install_dependencies(directory: str):
|
|
|
100 |
|
101 |
chain(
|
102 |
copy_remotion_app.si(remotion_app_dir, temp_dir),
|
103 |
+
# install_dependencies.si(temp_dir),
|
104 |
download_assets.si(links, temp_dir) if links else None,
|
105 |
render_video.si(temp_dir, output_dir),
|
106 |
cleanup_temp_directory.si(temp_dir, output_dir),
|
Dockerfile
CHANGED
@@ -32,6 +32,9 @@ RUN apt-get install -y \
|
|
32 |
libxrandr2 \
|
33 |
xdg-utils
|
34 |
|
|
|
|
|
|
|
35 |
# Download and install Thorium Browser
|
36 |
RUN wget https://github.com/Alex313031/thorium/releases/download/M117.0.5938.157/thorium-browser_117.0.5938.157_amd64.deb && \
|
37 |
dpkg -i thorium-browser_117.0.5938.157_amd64.deb
|
@@ -42,10 +45,18 @@ RUN apt-get update && apt-get install -y \
|
|
42 |
RUN npm install npm@latest -g && \
|
43 |
npm install n -g && \
|
44 |
n latest
|
|
|
|
|
|
|
45 |
RUN echo npm -v
|
46 |
RUN node -v
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
# Install Python dependencies
|
51 |
COPY requirements.txt .
|
|
|
32 |
libxrandr2 \
|
33 |
xdg-utils
|
34 |
|
35 |
+
# Copy the application code
|
36 |
+
COPY --chown=admin . /srv
|
37 |
+
|
38 |
# Download and install Thorium Browser
|
39 |
RUN wget https://github.com/Alex313031/thorium/releases/download/M117.0.5938.157/thorium-browser_117.0.5938.157_amd64.deb && \
|
40 |
dpkg -i thorium-browser_117.0.5938.157_amd64.deb
|
|
|
45 |
RUN npm install npm@latest -g && \
|
46 |
npm install n -g && \
|
47 |
n latest
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
RUN echo npm -v
|
52 |
RUN node -v
|
53 |
+
|
54 |
+
#install the stuff
|
55 |
+
RUN cd /srv/Remotion-app && npm install
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
|
61 |
# Install Python dependencies
|
62 |
COPY requirements.txt .
|