Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (62 loc) · 2.61 KB
/
Copy pathDockerfile
File metadata and controls
72 lines (62 loc) · 2.61 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
63
64
65
66
67
68
69
70
71
72
# Dockerfile
# Uses pre-built binaries from scripts/build-executables.js
# Run "node scripts/build-executables.js" before building this image.
FROM debian:bookworm-slim
ARG TARGETARCH
ARG APP_VERSION=0.0.1
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
openssl \
fuse \
wget \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Select and install the correct architecture using bind mount to avoid copying all binaries to the image layer
RUN --mount=type=bind,source=dist/executables,target=/tmp/executables \
set -e && \
case "$TARGETARCH" in \
amd64) ARCH_SUFFIX="x64" ;; \
arm64) ARCH_SUFFIX="arm64" ;; \
*) echo "Error: unsupported TARGETARCH '$TARGETARCH'"; exit 1 ;; \
esac && \
SOURCE_DIR="/tmp/executables/pluton-linux-${ARCH_SUFFIX}" && \
if [ ! -d "$SOURCE_DIR" ]; then \
echo "Error: Directory $SOURCE_DIR not found"; \
ls -R /tmp/executables; \
exit 1; \
fi && \
# Copy application files (use /. to copy all contents including hidden files)
cp -r "$SOURCE_DIR"/. /app/ && \
chmod +x /app/pluton && \
# Verify native modules were copied
if [ ! -f "/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node" ]; then \
echo "Error: better_sqlite3.node not found after copy"; \
ls -la /app/; \
exit 1; \
fi && \
# Setup binaries
mkdir -p /usr/local/bin && \
cp "/app/binaries/linux-${ARCH_SUFFIX}/restic" /usr/local/bin/restic && \
cp "/app/binaries/linux-${ARCH_SUFFIX}/rclone" /usr/local/bin/rclone && \
chmod +x /usr/local/bin/restic /usr/local/bin/rclone && \
# Remove duplicate binaries from app directory (they're now in /usr/local/bin)
rm -rf /app/binaries
# Create wrappers
RUN echo '#!/bin/sh' > /usr/local/bin/prclone && \
echo 'exec /usr/local/bin/rclone --config /data/config/rclone.conf "$@"' >> /usr/local/bin/prclone && \
chmod +x /usr/local/bin/prclone && \
echo '#!/bin/sh' > /usr/local/bin/prestic && \
echo 'export RCLONE_CONFIG=/data/config/rclone.conf' >> /usr/local/bin/prestic && \
echo 'exec /usr/local/bin/restic -o rclone.program=/usr/local/bin/rclone "$@"' >> /usr/local/bin/prestic && \
chmod +x /usr/local/bin/prestic
# Create data directories
RUN mkdir -p /data/config /data/db /data/logs /data/backups /data/progress /data/rescue /data/restore /data/stats /data/sync
ENV NODE_ENV=production \
IS_DOCKER=true \
SERVER_PORT=5173 \
APP_VERSION=${APP_VERSION} \
PLUTON_DATA_DIR=/data \
PATH="/usr/local/bin:$PATH"
EXPOSE 5173
CMD ["./pluton"]