-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
40 lines (31 loc) · 1.16 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim-amd64 AS build-env
ARG TARGETPLATFORM
ARG BUILDPLATFORM
# Install Node.js
RUN apt-get update && apt-get install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /App
COPY . ./
RUN echo "Building on ${BUILDPLATFORM} for ${TARGETPLATFORM}"
RUN dotnet restore
RUN dotnet publish -c Release -o out
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /App
EXPOSE 8267 8268
ENV ASPNETCORE_URLS="http://+:8267" \
OTA_UPDATE_PORT=8268 \
CONFIG_DIR="/config/espresense"
COPY --from=build-env /App/out .
LABEL \
io.hass.version="VERSION" \
io.hass.type="addon" \
io.hass.arch="${TARGETPLATFORM}"
ENTRYPOINT ["dotnet", "ESPresense.Companion.dll"]