-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (42 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
58 lines (42 loc) · 1.14 KB
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
# Build stage
FROM node:20-slim AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:20-slim
# Install FFmpeg & Nginx
RUN apt-get update && \
apt-get install -y ffmpeg && \
apt-get install -y nginx && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package files and install production dependencies
COPY package*.json ./
RUN npm ci --production
# Copy built assets and server files
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/server ./server
# Copy nginx configuration
COPY nginx.conf ./nginx.conf
# Create directories for data and temp files
RUN mkdir -p /data /movies /tmp/subtitles
# Set environment variables
ENV NODE_ENV=production \
DATA_DIR=/data \
MOVIES_DIR=/movies \
TEMP_DIR=/tmp/subtitles
# Expose both ports
EXPOSE 3000 80
# Create start script
RUN echo '#!/bin/sh\nnginx -c /app/nginx.conf -g "daemon off;" & node server/index.js' > start.sh && \
chmod +x start.sh
# Start both nginx and node server
CMD ["./start.sh"]