Update Docker files for Synology NAS compatibility (linux/amd64, v3 tag)

This commit is contained in:
Khoa Vo 2026-03-20 21:50:29 +07:00
parent 5c550a1f31
commit 2cdc3f7b26
2 changed files with 12 additions and 11 deletions

View file

@ -1,5 +1,5 @@
# Stage 1: Build Frontend # Build stage with explicit platform for Synology NAS compatibility
FROM node:20-alpine AS frontend-builder FROM --platform=linux/amd64 node:20-alpine AS frontend-builder
WORKDIR /app/frontend WORKDIR /app/frontend
COPY frontend-vite/package*.json ./ COPY frontend-vite/package*.json ./
@ -9,8 +9,8 @@ COPY frontend-vite/ .
ENV NODE_ENV=production ENV NODE_ENV=production
RUN npm run build RUN npm run build
# Stage 2: Build Backend (Rust) # Build Backend (Rust)
FROM rust:1.85-alpine AS backend-builder FROM --platform=linux/amd64 rust:1.85-alpine AS backend-builder
WORKDIR /app/backend WORKDIR /app/backend
RUN apk add --no-cache musl-dev openssl-dev perl RUN apk add --no-cache musl-dev openssl-dev perl
@ -21,8 +21,8 @@ RUN cargo fetch
COPY backend-rust/ ./ COPY backend-rust/ ./
RUN cargo build --release --bin backend-rust RUN cargo build --release --bin backend-rust
# Stage 3: Final Runtime # Final Runtime - using debian base for better amd64 compatibility on Synology
FROM python:3.11-slim-bookworm FROM --platform=linux/amd64 python:3.11-slim-bookworm
WORKDIR /app WORKDIR /app
@ -32,16 +32,11 @@ RUN apt-get update && apt-get install -y \
curl \ curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install yt-dlp
RUN pip install --no-cache-dir -U "yt-dlp[default]" RUN pip install --no-cache-dir -U "yt-dlp[default]"
# Copy backend binary
COPY --from=backend-builder /app/backend/target/release/backend-rust /app/server COPY --from=backend-builder /app/backend/target/release/backend-rust /app/server
# Copy frontend build
COPY --from=frontend-builder /app/frontend/dist /app/static COPY --from=frontend-builder /app/frontend/dist /app/static
# Create cache directories
RUN mkdir -p /tmp/spotify-clone-cache /tmp/spotify-clone-downloads && chmod 777 /tmp/spotify-clone-cache /tmp/spotify-clone-downloads RUN mkdir -p /tmp/spotify-clone-cache /tmp/spotify-clone-downloads && chmod 777 /tmp/spotify-clone-cache /tmp/spotify-clone-downloads
ENV PORT=8080 ENV PORT=8080
@ -49,4 +44,6 @@ ENV RUST_LOG=info
EXPOSE 8080 EXPOSE 8080
USER 1000
CMD ["/app/server"] CMD ["/app/server"]

View file

@ -2,6 +2,10 @@ services:
spotify-clone: spotify-clone:
image: git.khoavo.myds.me/vndangkhoa/spotify-clone:v3 image: git.khoavo.myds.me/vndangkhoa/spotify-clone:v3
container_name: spotify-clone container_name: spotify-clone
build:
context: .
dockerfile: Dockerfile
platform: linux/amd64
restart: unless-stopped restart: unless-stopped
ports: ports:
- "3110:8080" - "3110:8080"