단순 이관

This commit is contained in:
2026-04-20 20:27:42 +09:00
parent e6c530ff48
commit 83fb215eec
100 changed files with 4209 additions and 1467 deletions

65
Bitget_Server/Dockerfile Normal file
View File

@@ -0,0 +1,65 @@
# =============================================================================
# Bitget_Server Dockerfile (Ubuntu 24.04 / noble base, .NET 8.0)
#
# Build context: BitGet_API/ (솔루션 루트)
# 예) docker build -f Bitget_Server/Dockerfile -t bitget-server:latest .
# 또는 docker-compose up --build
# =============================================================================
# ---------------------------------------------------------------------------
# 1) Build stage — SDK 이미지에서 restore/publish 수행
# ---------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/sdk:8.0-noble AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
# restore 캐시 최적화: csproj 만 먼저 복사 → restore → 그 다음 전체 복사
COPY ["Bitget_Server/Bitget_Server.csproj", "Bitget_Server/"]
RUN dotnet restore "Bitget_Server/Bitget_Server.csproj"
# 전체 소스 복사
COPY . .
WORKDIR "/src/Bitget_Server"
RUN dotnet publish "Bitget_Server.csproj" \
-c $BUILD_CONFIGURATION \
-o /app/publish \
/p:UseAppHost=false
# ---------------------------------------------------------------------------
# 2) Runtime stage — ASP.NET Core 8.0 런타임 (Ubuntu 24.04 noble)
# ---------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/aspnet:8.0-noble AS final
# Healthcheck 를 위해 curl 설치 (비-root 전환 전에 수행)
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl tzdata \
&& rm -rf /var/lib/apt/lists/*
# 타임존 (기본 Asia/Seoul, compose 에서 TZ 환경변수로 덮어쓰기 가능)
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 영속화 디렉토리 준비 (compose 에서 볼륨 마운트 대상)
RUN mkdir -p /app/data /app/logs && chown -R $APP_UID:$APP_UID /app
WORKDIR /app
COPY --from=build /app/publish .
RUN chown -R $APP_UID:$APP_UID /app
# 비-root 사용자로 전환 (aspnet:8.0-noble 는 UID 1654 의 app 사용자 사전 정의)
USER $APP_UID
# Kestrel 포트 강제 (HTTP 전용 5000)
ENV ASPNETCORE_HTTP_PORTS=5000
ENV ASPNETCORE_URLS=http://+:5000
ENV DOTNET_RUNNING_IN_CONTAINER=true
EXPOSE 5000
# 컨테이너 내부 헬스체크 (compose 의 healthcheck 와 이중 안전망)
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl -fsS http://localhost:5000/api/health || exit 1
ENTRYPOINT ["dotnet", "Bitget_Server.dll"]