Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.55 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (36 loc) · 1.55 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
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:10.0.301 AS build-env
LABEL stage=build-env
WORKDIR /app
# Copy
COPY Directory.Packages.props /app/
COPY ./src/ /app/
ARG GIT_COMMIT
ARG GIT_BRANCH
# Build modules
RUN for module in /app/Modules/*; do \
dotnet build "$module" -c Release -p:SourceRevisionId=$GIT_COMMIT -p:GitBranch=$GIT_BRANCH; \
done
# Build plugins
RUN for plugin in /app/Plugins/*; do \
dotnet build "$plugin" -c Release -p:SourceRevisionId=$GIT_COMMIT -p:GitBranch=$GIT_BRANCH; \
done
# Publish Web project
RUN dotnet publish /app/Web/Grand.Web/Grand.Web.csproj -c Release -o ./build/release -p:SourceRevisionId=$GIT_COMMIT -p:GitBranch=$GIT_BRANCH
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
LABEL org.opencontainers.image.title="GrandNode" \
org.opencontainers.image.description="GrandNode e-commerce platform" \
org.opencontainers.image.url="https://grandnode.com" \
org.opencontainers.image.documentation="https://grandnode.com/knowledgebase" \
org.opencontainers.image.source="https://github.com/grandnode/grandnode2" \
org.opencontainers.image.vendor="GrandNode" \
org.opencontainers.image.licenses="GPL-3.0-only"
# Security fixes of the OS packages, without waiting for a rebuilt base image
RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
EXPOSE 8080
WORKDIR /app
COPY --from=build-env /app/build/release .
RUN mkdir -p /app/media && chown -R app:app /app/App_Data /app/wwwroot /app/Plugins /app/media
USER app
ENTRYPOINT ["dotnet", "Grand.Web.dll"]