forked from mayeaux/nodetube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.dev
66 lines (56 loc) · 1.84 KB
/
Dockerfile.dev
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
# Use Ubuntu as the base image
FROM ubuntu:22.04 as base
# Install dependencies
RUN apt-get update && apt-get install -y \
git \
tar \
python3 \
python3-pip \
nodejs \
npm \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy application files
COPY app* package* .env.settings.sample .env.private.sample copySettingsAndPrivateFiles.js Procfile routes.js /app/
COPY bin /app/bin/
COPY caching /app/caching/
COPY config /app/config/
COPY controllers /app/controllers/
COPY keys /app/keys/
COPY lib /app/lib/
COPY media /app/media/
COPY middlewares /app/middlewares/
COPY models /app/models/
COPY public /app/public/
COPY scripts /app/scripts/
COPY views /app/views/
# Build stage
FROM base as builder
WORKDIR /app/
# Install production dependencies and clean up unnecessary files
RUN npm install --production && \
node ./copySettingsAndPrivateFiles.js && \
rm -rf /app/node_modules/ffprobe-static/bin/darwin && \
rm -rf /app/node_modules/ffprobe-static/bin/win32 && \
rm -rf /app/node_modules/ffprobe-static/bin/linux/ia32 && \
rm -rf /app/node_modules/webp-converter/bin/libwebp_win64 && \
rm -rf /app/node_modules/webp-converter/bin/libwebp_osx && \
strip /app/node_modules/ngrok/bin/ngrok
# Final stage to run the application
FROM ubuntu:22.04
WORKDIR /app/
# Install runtime dependencies (only the essentials)
RUN apt-get update && apt-get install -y \
tar \
python3 \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# Copy built application from the builder stage
COPY --from=builder /app/ /app/
# Create symbolic links for ffprobe and ffmpeg
RUN ln -s /app/node_modules/ffprobe-static/bin/linux/x64/ffprobe /app/node_modules/@ffmpeg-installer/linux-x64/ffmpeg /usr/local/bin/
# Expose the necessary port
EXPOSE 8080
# Set the default command to run the application
CMD ["npm", "start"]