Skip to content

Commit

Permalink
refactor: refactor Dockerfile
Browse files Browse the repository at this point in the history
- Remove commented out code from Dockerfile
- Remove redundant empty lines from Dockerfile
- Update the base image for yt-dlp in Dockerfile

Signed-off-by: 陳鈞 <[email protected]>
  • Loading branch information
jim60105 committed Dec 13, 2023
1 parent 4183f54 commit 956fd71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#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.
### Debug image
### Setup the same as base image but used dotnet/runtime
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS debug

### Base image for yt-dlp
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine AS base
WORKDIR /app
RUN apk add --no-cache tzdata python3 && \
apk add --no-cache --virtual build-deps musl-dev gcc g++ python3-dev py3-pip && \
Expand All @@ -18,10 +18,8 @@ ENV TZ=Asia/Taipei
# https://github.com/dotnet/runtime/issues/34126#issuecomment-1104981659
ENV DOTNET_SYSTEM_IO_DISABLEFILELOCKING=true

### Debug image (same as base image)
### Rename for VS fast mode stage debugging
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS debug

### Base image for yt-dlp
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine AS base
WORKDIR /app
RUN apk add --no-cache tzdata python3 && \
apk add --no-cache --virtual build-deps musl-dev gcc g++ python3-dev py3-pip && \
Expand All @@ -38,7 +36,6 @@ ENV TZ=Asia/Taipei
# https://github.com/dotnet/runtime/issues/34126#issuecomment-1104981659
ENV DOTNET_SYSTEM_IO_DISABLEFILELOCKING=true


### Build .NET
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG BUILD_CONFIGURATION=Release
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ ENV TZ=Asia/Taipei
# https://github.com/dotnet/runtime/issues/34126#issuecomment-1104981659
ENV DOTNET_SYSTEM_IO_DISABLEFILELOCKING=true


### Debug image
FROM base AS debug

# Install .NET 8 SDK
RUN microdnf -y install dotnet-sdk-8.0


### Build .NET
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/dotnet-80 AS build

Expand All @@ -60,7 +58,6 @@ ARG BUILD_CONFIGURATION=Release
ARG TARGETARCH
RUN dotnet publish "YoutubeLiveChatToDiscord.csproj" -a $TARGETARCH -c $BUILD_CONFIGURATION -o /app/publish --self-contained true


### Final image
FROM base AS final

Expand Down

0 comments on commit 956fd71

Please sign in to comment.