Sign inSign up

vera2016/litepan-armv7

By vera2016

•Updated about 1 month ago

litepan for armv7

Image
0

164

vera2016/litepan-armv7 repository overview

litepan for armv7

https://github.com/Ponphil/LitePan⁠

# syntax=docker/dockerfile:1

# 1. 前端构建阶段:改用支持 ARMv7 的 node:20-alpine
FROM --platform=linux/amd64 node:20-alpine AS web

WORKDIR /src/web

COPY web/package.json web/package-lock.json ./
RUN npm config set registry https://registry.npmmirror.com \
    && npm ci

COPY web/ ./
RUN npm run build


# 2. 后端编译阶段:改用支持 ARMv7 的 golang:1.26-alpine
FROM golang:1.26-alpine AS build

WORKDIR /src

# 安装编译所需的基础工具(Alpine 需要)
RUN apk add --no-cache git

ENV GOTOOLCHAIN=local \
    CGO_ENABLED=0 \
    GOPROXY=https://goproxy.cn,direct
ARG BUILD_TAGS=fuse

COPY go.mod go.sum ./
RUN go mod download

COPY . .
COPY --from=web /src/internal/api/web /src/internal/api/web

RUN ls -la /src/drivers/ && cat /src/go.mod

ENV GO111MODULE=on

# 3. 修改编译命令:显式指定 GOOS/GOARCH/GOARM,并添加静态链接参数
RUN GOOS=linux GOARCH=arm GOARM=7 \
    go build -tags "${BUILD_TAGS}" -trimpath -ldflags="-s -w -extldflags '-static'" -o /out/litepan ./cmd/litepan


# 4. 运行时镜像保持不变 (debian:bookworm-slim 支持 armv7)
FROM debian:bookworm-slim AS runtime

RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates tzdata fuse3 \
    && sed -i 's/^#user_allow_other/user_allow_other/' /etc/fuse.conf 2>/dev/null || true \
    && grep -q '^user_allow_other' /etc/fuse.conf || echo user_allow_other >> /etc/fuse.conf \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

RUN mkdir -p /app/data/log /app/strm /app/mounts

COPY --from=build /out/litepan /app/litepan

ENV LITEPAN_DATA_DIR=/app/data \
    LITEPAN_STRM_DIR=/app/strm \
    LITEPAN_LISTEN=:5211 \
    LITEPAN_LOG_LEVEL=info \
    TZ=Asia/Shanghai

EXPOSE 5211 42069/tcp 42069/udp

VOLUME ["/app/data", "/app/strm", "/app/mounts"]

ENTRYPOINT ["/app/litepan"]
docker buildx build --platform linux/arm/v7 -t litepan:armv7 --output type=docker . --no-cache

Tag summary

Content type

Image

Digest

sha256:dc0f7512f…

Size

48.1 MB

Last updated

about 1 month ago

docker pull vera2016/litepan-armv7