Files
Flypaper/Dockerfile
T
TomandClaude Opus 5.5 4168e9990b
Build and deploy / build (push) Successful in 1m32s
Build and deploy / deploy (push) Successful in 22s
Release / image (push) Successful in 1m57s
Release / release (push) Successful in 7s
Add Unraid template, icon and privilege-dropping entrypoint
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 17:35:46 +01:00

45 lines
1.8 KiB
Docker

# The SDK stage runs natively on the build machine and cross-publishes for the
# target architecture. The runtime stage only copies files and sets metadata, so a
# multi-arch build needs no QEMU emulation at all.
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH
WORKDIR /src
COPY Directory.Build.props Directory.Packages.props ./
COPY src/Flypaper.Core/Flypaper.Core.csproj src/Flypaper.Core/
COPY src/Flypaper.GeoIp/Flypaper.GeoIp.csproj src/Flypaper.GeoIp/
COPY src/Flypaper.Http/Flypaper.Http.csproj src/Flypaper.Http/
COPY src/Flypaper.Storage/Flypaper.Storage.csproj src/Flypaper.Storage/
COPY src/Flypaper.Web/Flypaper.Web.csproj src/Flypaper.Web/
RUN dotnet restore src/Flypaper.Web/Flypaper.Web.csproj -a $TARGETARCH
COPY src/ src/
ARG VERSION=0.0.0-dev
RUN dotnet publish src/Flypaper.Web/Flypaper.Web.csproj -c Release -a $TARGETARCH -o /app --no-restore -p:Version=$VERSION \
&& mkdir /data
FROM mcr.microsoft.com/dotnet/aspnet:10.0
ARG VERSION=0.0.0-dev
WORKDIR /app
LABEL org.opencontainers.image.title="Flypaper" \
org.opencontainers.image.description="Self-hosted tarpit that traps and slows down scanning bots, with event logging and analysis." \
org.opencontainers.image.source="https://gitea.anticarnist.de/Tom/Flypaper" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.version=$VERSION
ENV ASPNETCORE_HTTP_PORTS= \
ConnectionStrings__Flypaper="Data Source=/data/flypaper.db" \
Flypaper__DataProtection__KeysPath=/data/keys \
Flypaper__GeoIp__Directory=/data/geoip
COPY --from=build --chown=1654:1654 /data /data
COPY --from=build /app .
COPY --chmod=755 docker-entrypoint.sh /usr/local/bin/flypaper-entrypoint
USER $APP_UID
EXPOSE 8080 8081
VOLUME /data
ENTRYPOINT ["flypaper-entrypoint"]