unarr/Dockerfile
Deivid Soto 763e267bf8
Some checks failed
Release / release (push) Failing after 0s
Release / docker (push) Has been skipped
Release / virustotal (push) Failing after 0s
chore(deps): bump Alpine 3.21→3.22, update CI actions and linter
- Dockerfile: alpine 3.21 → 3.22 (fewer CVEs per Docker Scout)
- release.yml: actions/checkout v4→v6, setup-go v5→v6, setup-buildx v3→v4
- ci.yml: golangci-lint v2.11.3 → v2.11.4
- DOCKERHUB.md: update Alpine version reference
2026-03-31 11:39:45 +02:00

43 lines
1 KiB
Docker

# ---- Build stage ----
FROM golang:1.25-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /src
# Copy go.mod/go.sum first for layer caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
ARG VERSION=dev
RUN CGO_ENABLED=0 go build -ldflags="-s -w -X github.com/torrentclaw/unarr/internal/cmd.Version=${VERSION}" -trimpath -o /unarr ./cmd/unarr/
# ---- Runtime stage ----
FROM alpine:3.22
RUN apk upgrade --no-cache && \
apk add --no-cache ca-certificates tzdata
# Non-root user (UID 1000 matches typical host user for volume permissions)
RUN addgroup -g 1000 unarr && adduser -u 1000 -G unarr -D -h /home/unarr unarr
# Default directories
RUN mkdir -p /config /downloads /data && \
chown -R unarr:unarr /config /downloads /data
USER unarr
COPY --from=builder /unarr /usr/local/bin/unarr
# Environment: point config/data to container paths
ENV UNARR_CONFIG_DIR=/config
ENV UNARR_DOWNLOAD_DIR=/downloads
ENV XDG_DATA_HOME=/data
VOLUME ["/config", "/downloads", "/data"]
ENTRYPOINT ["unarr"]
CMD ["start"]