-
Notifications
You must be signed in to change notification settings - Fork 125
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (44 loc) · 2.02 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (44 loc) · 2.02 KB
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
41
42
43
44
45
46
47
48
49
50
# Build OCPP Server
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build_server
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["OCPP.Core.Server/OCPP.Core.Server.csproj", "OCPP.Core.Server/"]
COPY ["OCPP.Core.Database/OCPP.Core.Database.csproj", "OCPP.Core.Database/"]
COPY ["OCPP.Core.Server.Extensions/OCPP.Core.Server.Extensions.csproj", "OCPP.Core.Server.Extensions/"]
RUN dotnet restore "./OCPP.Core.Server/OCPP.Core.Server.csproj"
COPY . .
RUN dotnet publish "./OCPP.Core.Server/OCPP.Core.Server.csproj" -c $BUILD_CONFIGURATION -o /app/server /p:UseAppHost=false
# Build Management UI
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build_management
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["OCPP.Core.Management/OCPP.Core.Management.csproj", "OCPP.Core.Management/"]
COPY ["OCPP.Core.Database/OCPP.Core.Database.csproj", "OCPP.Core.Database/"]
RUN dotnet restore "./OCPP.Core.Management/OCPP.Core.Management.csproj"
COPY . .
RUN dotnet publish "./OCPP.Core.Management/OCPP.Core.Management.csproj" -c $BUILD_CONFIGURATION -o /app/management /p:UseAppHost=false
# Final single-container image
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
LABEL org.opencontainers.image.source="https://github.com/dallmann-consulting/OCPP.Core"
WORKDIR /app
EXPOSE 8081 8082
# Defaults — override via environment variables or compose.yaml
ENV ASPNETCORE_ENVIRONMENT="Production" \
ConnectionStrings__SQLite="Filename=/db/OCPP.Core.sqlite;" \
MessageDumpDir="/tmp/ocpp" \
ServerApiUrl="http://localhost:8081/API" \
ApiKey="" \
Logging__LogLevel__Default="Information" \
Logging__LogLevel__OCPP="Information" \
Users__0__Username="admin" \
Users__0__Password="t3st" \
Users__0__Administrator="true"
COPY --chown=app:app --from=build_server /app/server ./server/
COPY --chown=app:app --from=build_management /app/management ./management/
COPY docker-start.sh /start.sh
RUN mkdir -p /db /tmp/ocpp && \
chown app:app /db /tmp/ocpp && \
sed -i 's/\r//' /start.sh && \
chmod +x /start.sh
USER app
ENTRYPOINT ["/start.sh"]