-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (46 loc) · 1.33 KB
/
Dockerfile
File metadata and controls
62 lines (46 loc) · 1.33 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
59
60
61
62
FROM node:24-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && \
apt-get install -y python3 make g++ curl git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set npm config to use python3
ENV npm_config_python=/usr/bin/python3
# Copy package files
COPY package*.json ./
COPY tsconfig.json ./
# Install dependencies
RUN npm install --build-from-source && \
npm install -g pkg
# Copy source files
COPY src ./src
COPY scripts ./scripts
COPY .env.example ./
# Build TypeScript
RUN npm run build:ts
# Create dist directories if needed
RUN mkdir -p dist dist-pkg
# Bundle for pkg (converts ES modules to CommonJS)
RUN npm run bundle-pkg
# Build for the same architecture as the base image
RUN pkg dist-pkg/bundled.cjs \
--compress GZip \
--public-packages "*" \
--public \
--no-bytecode \
--target node18-linux-x64 \
--output /usr/src/app/dist/uploader-linux-docker
FROM debian:bookworm-slim
WORKDIR /app
# Copy the built binary from the builder stage
COPY --from=builder /usr/src/app/dist/uploader-linux-docker /app/uploader
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Make the binary executable
RUN chmod +x /app/uploader
ENTRYPOINT ["/app/uploader"]
CMD ["--help"]