Skip to content

Commit b3d98cb

Browse files
committed
feat: dockerize the application
1 parent 298c753 commit b3d98cb

14 files changed

Lines changed: 123 additions & 104 deletions

File tree

.dockerignore

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
.react-router
2-
build
31
node_modules
4-
README.md
2+
build
3+
.react-router
4+
out
5+
*.log
6+
.env
7+
.git
8+
.gitignore
9+
README.md
10+
docker-compose.yml
11+
Dockerfile*

Dockerfile

Lines changed: 0 additions & 48 deletions
This file was deleted.

Dockerfile.backend

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Backend Dockerfile
2+
3+
FROM node:22-bookworm-slim
4+
WORKDIR /app
5+
6+
# Install Chrome dependencies
7+
RUN apt-get update
8+
RUN apt install -y \
9+
libnss3 \
10+
libdbus-1-3 \
11+
libatk1.0-0 \
12+
libgbm-dev \
13+
libasound2 \
14+
libxrandr2 \
15+
libxkbcommon-dev \
16+
libxfixes3 \
17+
libxcomposite1 \
18+
libxdamage1 \
19+
libatk-bridge2.0-0 \
20+
libpango-1.0-0 \
21+
libcairo2 \
22+
libcups2
23+
24+
# Install pnpm
25+
RUN npm install -g pnpm
26+
27+
# Copy package files and install dependencies
28+
COPY package.json pnpm-lock.yaml ./
29+
RUN pnpm install --frozen-lockfile
30+
31+
# Copy source code
32+
COPY . .
33+
34+
# Create output directory for rendered videos
35+
RUN mkdir -p /app/out
36+
37+
# Expose port
38+
EXPOSE 8000
39+
40+
# Start the backend
41+
CMD ["pnpm", "dlx", "tsx", "app/videorender/videorender.ts"]

Dockerfile.frontend

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Frontend Dockerfile
2+
3+
FROM node:20-bookworm-slim
4+
WORKDIR /app
5+
6+
# Install pnpm
7+
RUN npm install -g pnpm
8+
9+
# Copy package files and install dependencies
10+
COPY package.json pnpm-lock.yaml ./
11+
RUN pnpm install --frozen-lockfile
12+
13+
# Copy source code and build
14+
COPY . .
15+
RUN pnpm run build
16+
17+
# Expose port
18+
EXPOSE 3000
19+
20+
# Start the application
21+
CMD ["pnpm", "run", "start"]

app/components/timeline/VideoPlayerSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react"
2-
import { VideoPlayer } from "~/remotion/VideoPlayer"
2+
import { VideoPlayer } from "~/video-compositions/VideoPlayer"
33
import type { PlayerRef } from "@remotion/player"
44
import { type TimelineDataItem } from "./types"
55

app/remotion/Root.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ export const MyComposition = () => {
44
<p>hello world</p>
55
</>
66
)
7-
};
7+
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Sequence, OffthreadVideo } from "remotion";
1+
import { OffthreadVideo } from "remotion";
22

33

44
export const MyComp: React.FC<{ videoURL: string }> = ({ videoURL }) => {
@@ -10,4 +10,4 @@ export const MyComp: React.FC<{ videoURL: string }> = ({ videoURL }) => {
1010
</div>
1111
</>
1212
)
13-
};
13+
};

app/video-compositions/Root.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Composition } from 'remotion';
2+
import { MyComp } from './MyComp';
3+
4+
export const MyVideo = () => {
5+
return (
6+
<>
7+
<Composition component={MyComp} durationInFrames={120} width={1920} height={1080} fps={30} id="my-comp" defaultProps={{ text: 'World' }} />
8+
</>
9+
);
10+
};
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// this is the video player component. It basically takes the JSON representation of the timeline and renders it.
2-
31
import { Player, type PlayerRef } from '@remotion/player';
42
import { Sequence, AbsoluteFill, Img, Video } from 'remotion';
53
import React from 'react';
@@ -56,7 +54,7 @@ export function TimelineComposition({ timelineData, durationInFrames }: VideoPla
5654
textShadow: '2px 2px 4px rgba(0,0,0,0.5)',
5755
margin: 0,
5856
padding: '20px'
59-
}}>{scrubber.id}</p> {/* Using scrubber.id as placeholder for text content, update if actual text is available */}
57+
}}>{scrubber.id}</p>
6058
</div>
6159
</AbsoluteFill>
6260
);
@@ -80,7 +78,6 @@ export function TimelineComposition({ timelineData, durationInFrames }: VideoPla
8078
}
8179
break;
8280
default:
83-
// Optionally handle unknown media types or log a warning
8481
console.warn(`Unknown media type: ${scrubber.mediaType}`);
8582
break;
8683
}
@@ -119,4 +116,4 @@ export function VideoPlayer({ timelineData, durationInFrames, ref }: VideoPlayer
119116
controls
120117
/>
121118
);
122-
}
119+
}

0 commit comments

Comments
 (0)