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
FROM node:20-alpine AS frontend-builder
# Build stage with explicit platform for Synology NAS compatibility
FROM --platform=linux/amd64 node:20-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend-vite/package*.json ./
@ -9,8 +9,8 @@ COPY frontend-vite/ .
ENV NODE_ENV=production
RUN npm run build
# Stage 2: Build Backend (Rust)
FROM rust:1.85-alpine AS backend-builder
# Build Backend (Rust)
FROM --platform=linux/amd64 rust:1.85-alpine AS backend-builder
WORKDIR /app/backend
RUN apk add --no-cache musl-dev openssl-dev perl
@ -21,8 +21,8 @@ RUN cargo fetch
COPY backend-rust/ ./
RUN cargo build --release --bin backend-rust
# Stage 3: Final Runtime
FROM python:3.11-slim-bookworm
# Final Runtime - using debian base for better amd64 compatibility on Synology
FROM --platform=linux/amd64 python:3.11-slim-bookworm
WORKDIR /app
@ -32,16 +32,11 @@ RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install yt-dlp
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 frontend build
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
ENV PORT=8080
@ -49,4 +44,6 @@ ENV RUST_LOG=info
EXPOSE 8080
USER 1000
CMD ["/app/server"]

View file

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