- dev images are built only when the push touched code that image uses (path filters); webdrop-files does not wait for the frontend build - one v* tag releases both images (:tag and :latest) after the shared checks - registry build and push live in scripts/ci-publish-image.sh, used by every workflow - containers: fix the api Containerfile (missing Sync project), add Containerfile.files, Quadlet units for the file service (prod and dev), env examples, and registry auto-update for the production units so each machine pulls only the image it runs
38 lines
1.6 KiB
Docker
38 lines
1.6 KiB
Docker
# 文件服务(fileAPI):单独部署,放在存储所在的机器(例如家里的 NAS)。只依赖 FileProtocol 和 Sync,不带前端和数据库
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble-aot AS build
|
|
WORKDIR /src
|
|
COPY server/Directory.Build.props ./server/
|
|
COPY server/src/WebDrop.FileApi/WebDrop.FileApi.csproj ./server/src/WebDrop.FileApi/
|
|
COPY server/src/WebDrop.FileProtocol/WebDrop.FileProtocol.csproj ./server/src/WebDrop.FileProtocol/
|
|
COPY server/src/WebDrop.Sync/WebDrop.Sync.csproj ./server/src/WebDrop.Sync/
|
|
RUN dotnet restore server/src/WebDrop.FileApi/WebDrop.FileApi.csproj \
|
|
--runtime linux-x64
|
|
COPY server/src/WebDrop.FileApi/ ./server/src/WebDrop.FileApi/
|
|
COPY server/src/WebDrop.FileProtocol/ ./server/src/WebDrop.FileProtocol/
|
|
COPY server/src/WebDrop.Sync/ ./server/src/WebDrop.Sync/
|
|
RUN dotnet publish server/src/WebDrop.FileApi/WebDrop.FileApi.csproj \
|
|
--configuration Release \
|
|
--runtime linux-x64 \
|
|
--self-contained true \
|
|
--no-restore \
|
|
--output /out
|
|
|
|
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0 AS runtime
|
|
ARG WEBDROP_BACKEND_COMMIT=unknown
|
|
ARG WEBDROP_BACKEND_TAG=unknown
|
|
ARG WEBDROP_BUILD_TIME=unknown
|
|
LABEL org.opencontainers.image.revision=$WEBDROP_BACKEND_COMMIT \
|
|
org.opencontainers.image.version=$WEBDROP_BACKEND_TAG \
|
|
org.opencontainers.image.created=$WEBDROP_BUILD_TIME
|
|
WORKDIR /app
|
|
COPY --from=build /out/webdrop-files /app/webdrop-files
|
|
RUN mkdir -p /data \
|
|
&& chown 10001:10001 /data \
|
|
&& chmod 0750 /data
|
|
ENV ASPNETCORE_URLS=http://+:5100 \
|
|
FileApi__DataDir=/data \
|
|
DOTNET_EnableDiagnostics=0
|
|
USER 10001:10001
|
|
EXPOSE 5100
|
|
ENTRYPOINT ["/app/webdrop-files"]
|