Files
Telegram-Panel/Dockerfile.local
T

32 lines
1.1 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore "TelegramPanel.sln"
RUN dotnet publish "src/TelegramPanel.Web/TelegramPanel.Web.csproj" -c Release -o /app/publish --no-restore
# 说明:
# - 正常生产部署建议使用 mcr.microsoft.com/dotnet/aspnet:8.0 作为运行时镜像(更小)
# - 若当前网络环境导致 Docker/WSL 无法拉取 aspnet 镜像,可临时使用本文件(运行时使用 sdk 镜像)
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS final
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:5000
EXPOSE 5000
# 持久化目录:/data(通过 docker-compose 挂载)
# - 数据库:/data/telegram-panel.db
# - session:/data/sessions/
# - 本地配置:/data/appsettings.local.json(UI 保存 Telegram ApiId/ApiHash/同步开关等)
# - 后台密码:/data/admin_auth.json
RUN mkdir -p /data /data/sessions /data/logs \
&& rm -rf /app/logs \
&& ln -s /data/logs /app/logs \
&& ln -s /data/appsettings.local.json /app/appsettings.local.json || true
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "TelegramPanel.Web.dll"]