-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (27 loc) · 854 Bytes
/
Dockerfile
File metadata and controls
32 lines (27 loc) · 854 Bytes
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
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y \
nodejs \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY ["HvZBot.csproj", "HvZBot/"]
RUN dotnet restore "HvZBot/HvZBot.csproj"
WORKDIR "/src/HvZBot"
COPY . .
RUN dotnet build "HvZBot.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "HvZBot.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
ARG GID=1000
ARG UID=1000
RUN groupadd --gid $GID appgroup && \
useradd --uid $UID --gid $GID --create-home --shell /bin/bash appuser && \
chown -R appuser /app
USER appuser
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HvZBot.dll"]