ProjectLighthouse/Dockerfile
sudokoko 01e6fa191a
Update to .NET 8 and C# 12 (#952)
* Initial SDK and dependency bumps

* Bump Pomelo.EntityFrameworkCore.MySql to 8.0.0-beta.2

Should fix the MissingMethodException error in unit tests

* Update CI workflow to use .NET 8

* Apply suggested change from compile time warnings

* Fix digest tests

* Bump dependencies once more

* Update xunit

* Remove obsolete ISystemClock from TokenAuthHandler

* Update dependencies

* Add digest debug preprocessors back

* Maybe don't break #966

* Bump EF Driver and update various NET7 references

* Fix warnings in digest middleware tests

---------

Co-authored-by: Slendy <josh@slendy.pw>
2024-02-26 20:08:48 +00:00

40 lines
No EOL
1.2 KiB
Docker

# Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /ProjectLighthouse
COPY *.sln ./
COPY **/*.csproj ./
RUN dotnet sln list | grep ".csproj" \
| while read -r line; do \
mkdir -p $(dirname $line); \
mv $(basename $line) $(dirname $line); \
done;
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release --property:OutputPath=/ProjectLighthouse/out/ --no-restore
# Final running container
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final
# Add non-root user
RUN addgroup -S lighthouse --gid 1001 && \
adduser -S lighthouse -G lighthouse -h /lighthouse --uid 1001 && \
mkdir -p /lighthouse/data && \
mkdir -p /lighthouse/app && \
mkdir -p /lighthouse/temp && \
apk add --no-cache icu-libs su-exec tzdata
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
# Copy build files
COPY --from=build /ProjectLighthouse/out/publish /lighthouse/app
COPY --from=build /ProjectLighthouse/ProjectLighthouse/StaticFiles /lighthouse/temp/StaticFiles
COPY --from=build /ProjectLighthouse/scripts-and-tools/docker-entrypoint.sh /lighthouse
RUN chown -R lighthouse:lighthouse /lighthouse && \
chmod +x /lighthouse/docker-entrypoint.sh && \
cp /lighthouse/app/appsettings.json /lighthouse/temp
ENTRYPOINT ["/lighthouse/docker-entrypoint.sh"]