Last active
April 25, 2020 18:34
-
-
Save thnk2wn/b22641aa9badad9b42f8f46c4d80e419 to your computer and use it in GitHub Desktop.
Used in Post: Deploying to Raspberry Pi with GitHub Actions and Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Global build arguments to be used in later step. Mostly metadata for labels. | |
ARG GIT_SHA | |
ARG GIT_REF | |
ARG BUILD_DATE | |
ARG BUILD_VER | |
# Stage 1 - build | |
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build | |
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 | |
WORKDIR /build | |
COPY . . | |
RUN echo $(ls .) | |
RUN dotnet restore | |
RUN dotnet publish -c Release -o /app | |
RUN echo $(ls /app) | |
# Stage 2 - Final runtime base image | |
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.2-buster-slim-arm32v7 AS final | |
ARG GIT_SHA | |
ARG GIT_REF | |
ARG BUILD_DATE | |
ARG BUILD_VER | |
LABEL GIT_SHA=$GIT_SHA | |
LABEL GIT_REF=$GIT_REF | |
LABEL BUILD_DATE=$BUILD_DATE | |
LABEL BUILD_VER=$BUILD_VER | |
WORKDIR /app | |
COPY --from=build /app . | |
# --- System / hardware / 3rd party library dependencies --- | |
# Currently needed for camera access | |
ENV LD_LIBRARY_PATH /opt/vc/lib | |
# For Unosquare camera (which just shells to raspistill) | |
ENV PATH="/opt/vc/bin:${PATH}" | |
# --- PI System Level Env Vars --- | |
# Time will be UTC by Default, regardless of host PI settings | |
ENV TZ=America/New_York | |
# --- Logging --- | |
# Default log level | |
ENV Serilog__MinimumLevel Information | |
# Tone down ASP.NET Core logging | |
ENV Serilog__MinimumLevel__Override__Microsoft Warning | |
# Log level for Camera Library | |
ENV Serilog__MinimumLevel__Override__MMALSharp Information | |
# --- Custom app environment variable settings --- | |
# Number of seconds to capture footage after motion detection | |
ENV Siren__CaptureDuration 10 | |
# Passive Infrared (PIR) GPIO Pin | |
ENV Siren__PirPin 17 | |
# Cooldown period in seconds after motion detection before detection will be enabled again | |
ENV Siren__ResetMotionAfter 15 | |
# Number of days after which to delete previously captured siren footage. | |
ENV Siren__MediaCleanupAfterDays 1 | |
# Needs over a minute for accurate initial PIR sensor readings. | |
ENV Siren__WarmupInterval 90 | |
ENTRYPOINT ["dotnet", "./siren.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment