DiscordChatExporter/DiscordChatExporter.Cli.dockerfile

45 lines
1.2 KiB
Text
Raw Normal View History

2023-01-05 07:20:49 -05:00
# -- Build
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
WORKDIR /build
2022-06-18 15:37:24 -04:00
COPY favicon.ico ./
COPY NuGet.config ./
COPY Directory.Build.props ./
COPY DiscordChatExporter.Core ./DiscordChatExporter.Core
COPY DiscordChatExporter.Cli ./DiscordChatExporter.Cli
RUN dotnet publish DiscordChatExporter.Cli \
--self-contained \
--use-current-runtime \
--configuration Release \
--output ./publish
2022-06-18 15:37:24 -04:00
2023-01-05 07:20:49 -05:00
# -- Run
FROM mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine
2022-06-18 15:37:24 -04:00
2023-01-05 07:20:49 -05:00
# Alpine dotnet image doesn't include timezone data, which is needed
# for certain date/time operations.
RUN apk add --no-cache tzdata
2023-01-05 07:20:49 -05:00
# Create a non-root user to run the app, so that the output files
# can be accessed by the host.
# https://github.com/Tyrrrz/DiscordChatExporter/issues/851
RUN adduser \
--disabled-password \
--no-create-home \
dce
2023-01-05 07:20:49 -05:00
USER dce
2023-01-05 07:20:49 -05:00
COPY --from=build /build/publish /opt/dce
2022-10-16 09:34:31 -04:00
# Need to keep this as /out for backwards compatibility with documentation.
# A lot of people have this directory mounted in their scripts files, so
# changing it would break existing workflows.
WORKDIR /out
2022-10-16 09:34:31 -04:00
2023-01-05 07:20:49 -05:00
# Add the app directory to PATH so that it's easier to debug using a shell
ENV PATH="$PATH:/opt/dce"
ENTRYPOINT ["DiscordChatExporter.Cli"]