diff --git a/.dockerignore b/.dockerignore index 3729ff0..a54bf73 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,4 +22,8 @@ **/secrets.dev.yaml **/values.dev.yaml LICENSE -README.md \ No newline at end of file +README.md +**/helm-chart +**/.github +.dockerignore +.gitignore diff --git a/Dockerfile b/Dockerfile index e8b364e..2f29950 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine AS base +FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS base WORKDIR /app RUN apk add --no-cache --virtual build-deps musl-dev gcc g++ python3-dev &&\ apk add --no-cache py3-pip tzdata &&\ @@ -12,24 +12,21 @@ ENV TZ=Asia/Taipei # https://github.com/dotnet/runtime/issues/34126#issuecomment-1104981659 ENV DOTNET_SYSTEM_IO_DISABLEFILELOCKING=true -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build +ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["YoutubeLiveChatToDiscord.csproj", "."] -RUN dotnet restore "./YoutubeLiveChatToDiscord.csproj" +RUN dotnet restore "YoutubeLiveChatToDiscord.csproj" COPY . . -WORKDIR "/src/." -RUN dotnet build "YoutubeLiveChatToDiscord.csproj" -c Release -o /app/build +RUN dotnet build "YoutubeLiveChatToDiscord.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish -RUN dotnet publish "YoutubeLiveChatToDiscord.csproj" -c Release -o /app/publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "YoutubeLiveChatToDiscord.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . - -RUN addgroup -g 1000 docker && \ - adduser -u 1000 -G docker -h /home/docker -s /bin/sh -D docker \ - && chown -R 1000:1000 . -USER docker - +RUN mkdir -p /app && chown -R app:app /app +USER app ENTRYPOINT ["dotnet", "YoutubeLiveChatToDiscord.dll"] \ No newline at end of file diff --git a/YoutubeLiveChatToDiscord.csproj b/YoutubeLiveChatToDiscord.csproj index a3c0e15..633538f 100644 --- a/YoutubeLiveChatToDiscord.csproj +++ b/YoutubeLiveChatToDiscord.csproj @@ -10,6 +10,7 @@ +