Add Docker image support for Synology NAS with linux/amd64 platform

This commit is contained in:
vndangkhoa 2026-04-04 16:01:32 +07:00
parent dc047c2412
commit 7fa9f00cce
3 changed files with 51 additions and 3 deletions

View file

@ -1 +1,9 @@
downloads/ downloads/
download/
.git/
.github/
.forgejo/
.idea/
.DS_Store
*.md
media-roller

18
Dockerfile Executable file → Normal file
View file

@ -1,5 +1,8 @@
FROM golang:1.25.3-alpine3.22 AS builder # syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:1.25.3-alpine3.22 AS builder
ARG TARGETOS
ARG TARGETARCH
RUN apk add --no-cache curl RUN apk add --no-cache curl
WORKDIR /app WORKDIR /app
@ -10,10 +13,16 @@ COPY go.mod go.mod
COPY go.sum go.sum COPY go.sum go.sum
RUN go mod download RUN go mod download
RUN go build -x -o media-roller ./src RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -x -o media-roller ./src
# yt-dlp needs python # yt-dlp needs python
FROM python:3.13.7-alpine3.22 FROM --platform=$TARGETPLATFORM python:3.13.7-alpine3.22
ARG TARGETARCH
LABEL org.opencontainers.image.source="https://git.khoavo.myds.me/vndangkhoa/kv-download"
LABEL org.opencontainers.image.description="Media Roller - Mobile friendly video downloader"
LABEL org.opencontainers.image.licenses="MIT"
# This is where the downloaded files will be saved in the container. # This is where the downloaded files will be saved in the container.
ENV MR_DOWNLOAD_DIR="/download" ENV MR_DOWNLOAD_DIR="/download"
@ -47,4 +56,7 @@ RUN yt-dlp --version && \
EXPOSE 9292 EXPOSE 9292
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:9292/ || exit 1
ENTRYPOINT ["/app/media-roller"] ENTRYPOINT ["/app/media-roller"]

28
docker-compose.yml Normal file
View file

@ -0,0 +1,28 @@
services:
kv-download:
image: git.khoavo.myds.me/vndangkhoa/kv-download:latest
container_name: kv-download
restart: unless-stopped
ports:
- "9292:9292"
volumes:
- ./downloads:/download
environment:
- MR_DOWNLOAD_DIR=/download
- TZ=Asia/Ho_Chi_Minh
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9292/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
deploy:
resources:
limits:
memory: 1G
cpus: "1.0"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"