-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.web
30 lines (27 loc) · 1.22 KB
/
Dockerfile.web
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
# Set the major version of dotnet
ARG DOTNET_VERSION=8.0
# Set the major version of nodejs
ARG NODEJS_VERSION_MAJOR=22
# Build frontend assets using node js
FROM "node:${NODEJS_VERSION_MAJOR}-bullseye-slim" AS assets
WORKDIR /app
COPY ./Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/wwwroot /app
RUN npm install
RUN npm run build
# Build the app using the dotnet SDK
FROM "mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-azurelinux3.0" AS build
WORKDIR /build
COPY ./Dfe.ManageFreeSchoolProjects/ /build
RUN ["dotnet", "restore", "Dfe.ManageFreeSchoolProjects"]
RUN ["dotnet", "build", "Dfe.ManageFreeSchoolProjects", "--no-restore", "-c", "Release"]
RUN ["dotnet", "publish", "Dfe.ManageFreeSchoolProjects", "--no-build", "-o", "/app"]
# Build a runtime environment
FROM "mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}-azurelinux3.0" AS runtime
WORKDIR /app
LABEL org.opencontainers.image.source="https://github.com/DFE-Digital/manage-free-school-projects"
LABEL org.opencontainers.image.description="Manage Free School Projects - App"
COPY --from=build /app /app
COPY --from=assets /app /app/wwwroot
COPY ./script/web-docker-entrypoint.sh /app/docker-entrypoint.sh
RUN ["chmod", "+x", "/app/docker-entrypoint.sh"]
USER $APP_UID