Skip to content

Commit 72e80c5

Browse files
committed
Move dotnet publish into Dockerfile
1 parent c84e3c7 commit 72e80c5

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

TeachingRecordSystem/Dockerfile

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
# syntax=docker/dockerfile:1
2-
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine3.22
31
ARG GIT_SHA
2+
3+
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine3.23@sha256:732cd42c6f659814c9804ad7b05c7f761e83ef8379c5b2fdc3af673353caff73 AS build
4+
WORKDIR /source
5+
6+
COPY . ./
7+
RUN dotnet tool restore
8+
RUN dotnet restore
9+
RUN dotnet publish --no-restore --configuration Release
10+
11+
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine3.23@sha256:1201dde897ab436b7c6b386f6dbd4f9a3ca0245f9c5a8aac8f8bcdccb4c7d484
12+
WORKDIR /Apps
13+
COPY --from=build /source/src/TeachingRecordSystem.Api/bin/Release/net10.0/publish/ ./Api/
14+
COPY --from=build /source/src/TeachingRecordSystem.Cli/bin/Release/net10.0/publish/ ./TrsCli/
15+
COPY --from=build /source/src/TeachingRecordSystem.SupportUi/bin/Release/net10.0/publish/ ./SupportUi/
16+
COPY --from=build /source/src/TeachingRecordSystem.Worker/bin/Release/net10.0/publish/ ./Worker/
17+
COPY --from=build /source/src/TeachingRecordSystem.AuthorizeAccess/bin/Release/net10.0/publish/ ./AuthorizeAccess/
18+
COPY --from=build /source/db.sh .
19+
20+
RUN chmod +x ./db.sh
21+
422
ENV SENTRY_RELEASE=${GIT_SHA}
523
ENV GIT_SHA=${GIT_SHA}
624
ENV ASPNETCORE_HTTP_PORTS=3000
7-
COPY src/TeachingRecordSystem.Api/bin/Release/net10.0/publish/ Apps/Api/
8-
COPY src/TeachingRecordSystem.Cli/bin/Release/net10.0/publish/ Apps/TrsCli/
9-
COPY src/TeachingRecordSystem.SupportUi/bin/Release/net10.0/publish/ Apps/SupportUi/
10-
COPY src/TeachingRecordSystem.Worker/bin/Release/net10.0/publish/ Apps/Worker/
11-
COPY src/TeachingRecordSystem.AuthorizeAccess/bin/Release/net10.0/publish/ Apps/AuthorizeAccess/
12-
COPY db.sh Apps/db.sh
13-
WORKDIR /Apps
14-
15-
RUN chmod +x /Apps/db.sh
25+
ENV PATH="${PATH}:/Apps/TrsCli"
1626

1727
# Install Culture prerequisities
1828
RUN apk add --no-cache \
@@ -42,5 +52,3 @@ RUN apk add --allow-untrusted msodbcsql18_18.0.1.1-1_amd64.apk && \
4252
RUN addgroup -S appgroup -g 20001 && adduser -S appuser -G appgroup -u 10001
4353

4454
USER 10001
45-
46-
ENV PATH="${PATH}:/Apps/TrsCli"

justfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ watch-worker:
9090

9191
# Build the Docker image
9292
[working-directory: 'TeachingRecordSystem']
93-
docker-build *ARGS: restore
94-
@dotnet publish -c Release --no-restore
93+
docker-build *ARGS:
9594
@docker build . {{ARGS}}
9695

9796
# Set a configuration entry in user secrets for running the apps

0 commit comments

Comments
 (0)